Comments
Make a Comment
When creating a C# program, we can jot down some notes by adding one line comment using //
or multi-line comment using /*
and */
(Note: The instructions in the previous activities were written as comments).
Also, adding comments will not affect the program whatsoever. So, you can add comments throughout your code to document how it works for you and other coders.
// sample one line comment
/* sample
* multi-line
* comment */
Play with Comments
In the .NET Fiddle frame below, add a single line comment and a multi-line comment to your program.
You can comment you code so the computer won’t run it.
Console.Write("I like to eat");
// Console.Write("apples.");
Will write “I like to eat” to the console but won’t write “apples”.