/* */

[Further Syntax]


評論 are lines in the program that are used to inform yourself or others about the way the program works. They are ignored by the compiler, and not exported to the processor, so they don’t take up any space in the microcontroller’s flash memory. Comments’ only purpose is to help you understand (or remember) or to inform others about how your program works.

The beginning of a block comment or a multi-line comment is marked by the symbol /* and the symbol */ marks its end. This type of comment is called so as this can extend over more than one line; once the compiler reads the /* it ignores whatever follows until it encounters a */.

Example Code

/* This is a valid comment */

  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
  (Another valid comment)

  if (gwb == 0) { // single line comment is OK inside a multi-line comment
    x = 3;          
// don't forget the "closing" comment - they have to be balanced!

Notes and Warnings

When experimenting with code, “commenting out” parts of your program is a convenient way to remove lines that may be buggy. This leaves the lines in the code, but turns them into comments, so the compiler just ignores them. This can be especially useful when trying to locate a problem, or when a program refuses to compile and the compiler error is cryptic or unhelpful.


86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *