CSCI 150

Home | | Course Schedule | | Assignments | | Lecture Notes

Rules for using comments:

It is important to use comments and indentation to make your programs easy to read and understand. This is particularly true when the programs start to get large and somewhat more complicated.

Program Prologues:
Comments are notes that the programmer writes in English, stating what a particular piece of code does, who wrote it, etc. They are not part of the program that the computer will execute. In Pascal, comments are set apart from the regular code using brackets: {}. Every program you write in this class will have a program prologue that contains the name of the program, your name, the date, the class and section, the assignment or lab number and the purpose of the program. The standard prologue should look as follows:

Comments on variables:
Each variable declaration should have a comment next to it indicating the purpose of the variable.

Comments at the beginning and end of major program blocks:
Each procedure or function should have a prologue giving the name purpose and a description of the parameters used in the function or procedure call. Each major function, procedure or program block should have a comment immediately following the end statement indicating the name of the function or program that is just ended. An example follows: