next up previous contents
Next: Adding More Statements Up: Printing to the Output Previous: begin...end   Contents

writeln

writeln('test!') is a statement. It invokes a method called writeln and supplies a parameter 'test!' to it. writeln means ``write line'', it optionally prints something to the output and ends the current line. If a program has anything for writeln to output before it ends the current line, the text to print must be enclosed by parentheses.

In our example, we want to print test! to the output, therefore it is enclosed by parentheses after writeln. Note that we also use the single quote ' to enclose test!. This is because contents enclosed by a pair of single quotes is considered literal. For now, don't worry about what is literal; just remember to enclose what you want to appear in the output in single quotes.



Tak Auyeung 2003-12-03