Sunday, October 10, 2010

9. Comments

So here's a super quick tutorial about comments, this is just because it is important and super useful and I have a little bit of time so anyways.  Comments are a way for programmers to keep track of what they are programming.  The computer doesn't pay attention to them so they are really useful for keeping track of stuff.

To do a single-line comment you do this:
//this is a single line comment
To do a multi-line comment you do this:
/** This is a multiple line comment
I can write on more than one line
and the computer will still not
care what I write!!!!!!**/
You can use comments to label certain parts of your program such as:
//this for loop runs from 1 to 10
See how this makes it easier for the programmer to understand what if going on in the program?  It is good programming practice to leave comments so that you actually understand what you are writing! 
That was a super-quick tutorial, I will post more about the random numbers and such tomorrow (hopefully!).

See you then!

No comments:

Post a Comment