C# Comments

Comments

In C#, comments are non-executable statements used to make the code more understandable and maintainable. They are ignored by the compiler during code execution. Comments are a crucial part of writing clear and maintainable code, providing explanations and notes that help both the original developer and others who might work with the code later.

2 types of comments are there for example :

1. Single-line comments: These comments start with // and extend to the end of the line. They are useful for brief explanations or notes about specific lines or blocks of code.

2. Multi-line comments: These comments start with /* and end with */. They can span multiple lines and are useful for longer explanations or for commenting out large sections of code.

Example Single-line comment:

int Age = 15;  // Assigning value 15 to variable Age

Example Multi-line comments:

int Age = 15;  /* Assigning value 15 to variable Age

                               As this is a required condition */

Course Video