Line comment

From Microduino Wiki
Jump to: navigation, search
  • Comments

Comments are used to remind yourself or others that how the program works. They are ignored by the compiler and can’t be transmitted to the operator, so they don’t occupy space in Atmega chip. The only effect of comment is to make yourself understand or help you recall or remind others how your program works . There are two ways to write comments:

  • Example

 x = 5;  // this is a single line comment, the whole line behind the slash is a comment
/* this is an enclosed block comment 
if (gwb == 0){   // It is possible to enclose single line comments within a block comment. 
x = 3;           /* Enclosing a second block comment is not allowed.
// Don’t forget the ending sign of comments-they appear in pairs!
  • Note

When testing the code, commenting out an a area of code which may have errors is a very effective method, which can make the code become comment and be saved in the program and ignored by the compiler. This method is very effective to find out errors or when the compiler promotes that there are some errors or the errors are subtle.

[Return to Arduino Syntax Manual]