Progamming Comments
It is good practice to include lots of comments in your code so that when you or someone else comes back and looks at the code you/they will understand what it is meant to do.
A comment will be ignored by the compiler, this means that anything in between the comment tags will not become a program. (Makes any scene?)
Normally there are two ways to write comments, one is a single line, and one is a multi line comment. There names explain what they mean.
So in Java a single line comment will look like this:
// Comment Text
And a multi line comment will look like this:
/*
More than one line
See!*/
And in C++ a single line comment will look like this:
// Comment Text
And a multi line comment will look like this:
/*
More than one line
See!*/
And in python a singe line comment is done like is:
# Comment text
And a multi lined comment will go like this:
" " " this is a multi line comment which spawns many lines " " "
As you can see Java and C++ have the same way of creating comments but Python has a different way just to let you know that all languages do not have th same way of commenting text.
Useful Python Commenting Information
And for a small side note here is how to write comments in HTML and PHP.
HTML
<!-- Comment text in here -->
PHP
// Comment text in here - Single line
/* Comment text in here, many lines */
Hope this helps, Pete
If you liked this and are a nice person would you like to donate to my Stargate fund?



No Responses to “Progamming Comments”
Please Wait
Leave a Reply