how to program
HOW TO PROGRAM . IT - learn how to program - online interactive programming tutorial and programming course
0
Block Comments

Lesson 03: Block comments are a way of commenting and documenting your program where the comment text can go onto several lines. Explaining what is going on in your program is important for maintenance purposes and sometimes more wordy descriptions are required, it helps you remember what is going on either if you or someone else revisits and needs to change, improve, support, fix, port (migrate to another environment) your program in the future.

Block comments start with a /* and end with a */
The following code demonstrates some examples of block line comments...

Program Code:
Output:


The last block comment also demonstrates the idea of "commenting out" multiple lines of real code so that it does not get run. This might be better than deleting the code, since it is easy to remove the comments to let the code run again at a later time. Block comments can contain (comment out) blocks containing other line comments.

The above example also demonstrates the use of line spaces, to split up the program so that it is more easily read.

Exercises:

1. Get the "Hello Everybody" and "Hello Universe" lines working by removing the comment
2. Then switch them off again by commenting them out with a block comment

To return to previous page click here

 
0
by running the tutorial programs on this site, you are agreeing to our terms and conditions (please check these first).
Mon 10 Dec 2018 web design | login © 2018 Abstract Worlds Ltd