Block Statements



next up previous
Next: Goto Statements Up: No Title Previous: RecordsStructures, Types

Block Statements

Block statements (the group of statements within a begin-end pair in Pascal or between braces in C) deserve a comment. This comment should indicate what is happening in the block, such as the action for each pass through the loop, or what action is being executed in the else part of an if statement. In addition, at the end of the block, a comment should indicate what block is being closed. Here is an example in C.

while (listptr != NULL)
   { /* sum all values on the list */
     total += listptr->value;
     listptr = listptr->next;
   } /* while (listptr != NULL) */



cs2604 class account
Mon Jan 23 10:42:49 EST 1995