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

Commenting

For simple programs, you probably don't need any help reminding you what the program does. I can probably write hundreds of lines and still remember what each line does (in the context of the program).

Unfortunately, real programs have at least thousands of lines. This makes it difficult to just read the program and remember what each statement does in the context of the entire program. Almost all programming languages allow you to add notes to your program. Such notes is called comments, they are completely ignored by the computer, so you can use any format you like.

For the test program, I may want to add just a little bit of comments so the program now looks like this.

begin
  writeln('Tak Auyeung');     { my name }
  writeln('999 Milky Way');   { street address}
  writeln('Galaxy, UV 99999') { city and state}
  { Of course, you realize this address is
    completely fake. Don't try to send me 
    anything via this address! }
end.

In Pascal, the curly braces ({}) enclose comments. Comments can span any number of lines. Pascal also accept (* to begin comments and *) to end comments, but that's more typing.



Tak Auyeung 2003-12-03