Gosu comments
Add comments to your Gosu code to explain its programming logic. Gosu supports several styles of comments.
Block comments |
Use block comments
to describe the purpose of classes and methods. A block comment begins
with a slash/asterisk ( /* * This is a block comment. * Use block comments at the beginnings of files and before * classes and functions. */ Use proper capitalization and punctuation in block comments. |
Single-line comments |
Use single-line comments
to describe one or more statements within a function or method. A single-line
comment begins with double slashes (
If you cannot fit your comment on a single line, use a sequence of single-line statements. |
Trailing comments |
Use trailing comments to briefly describe single lines of code. A trailing comment begins with double slashes (//) as the first non-whitespace characters after the code that the comment describes.
If you place two or more trailing comments on lines of code in a block, indent them all to a common alignment |
You can use some styles of comments to temporarily disable lines or blocks of code during development and testing. This technique is known as commenting out code.
Commenting out a single line of code |
Use a single-line
comment delimiter (
|
Commenting out a block of code |
Use a pair of block
comment delimiters (
The preceding function cannot be called, because it is commented out. Gosu permits the nested block comment within the commented out block of code. |
See also
