[更多語法]
說明
注釋是程序中的行,用於告知您自己或他人該程序的工作方式。它們被編譯器忽略,不會導出到處理器,因此它們不會占用微控製器閃存中的任何空間。評論的唯一目的是幫助您理解(或記住),或告知其他人您的程序是如何工作的。
塊注釋或多行注釋的開頭用符號/*
標記,符號*/
標記其結尾。調用這種類型的注釋是因為它可以超過一行;一旦編譯器讀取 /*
,它就會忽略後麵的任何內容,直到遇到 */
。
示例代碼
/* This is a valid comment */
/*
Blink
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; /* but not another multi-line comment - this is invalid */
}
// don't forget the "closing" comment - they have to be balanced!
*/
注意事項和警告
在試驗代碼時,程序的"commenting out" 部分是刪除可能有錯誤的行的便捷方法。這會留下代碼中的行,但會將它們變成注釋,因此編譯器會忽略它們。當試圖定位問題,或者當程序拒絕編譯並且編譯器錯誤是神秘的或無用的時,這可能特別有用。
相關用法
- Arduino //用法及代碼示例
- Arduino /=用法及代碼示例
- Arduino /用法及代碼示例
- Arduino long用法及代碼示例
- Arduino Arduino_EMBRYO_2 - setLengthXY()用法及代碼示例
- Arduino ~用法及代碼示例
- Arduino ArduinoBLE - bleDevice.advertisedServiceUuidCount()用法及代碼示例
- Arduino const用法及代碼示例
- Arduino Ethernet - server.begin()用法及代碼示例
- Arduino ArduinoBLE - BLEService()用法及代碼示例
- Arduino digitalWrite()用法及代碼示例
- Arduino ArduinoBLE - bleCharacteristic.subscribe()用法及代碼示例
- Arduino Servo - attach()用法及代碼示例
- Arduino write()用法及代碼示例
- Arduino Arduino_LSM9DS1 - readGyroscope()用法及代碼示例
- Arduino ArduinoSound - FFTAnalyzer.input()用法及代碼示例
- Arduino MKRGSM - gprs.attachGPRS()用法及代碼示例
- Arduino WiFiNINA - WiFi.config()用法及代碼示例
- Arduino MKRGSM - sms.read()用法及代碼示例
- Arduino MKRNB - getCurrentCarrier()用法及代碼示例
- Arduino Scheduler - Scheduler.startLoop()用法及代碼示例
- Arduino Arduino_LSM9DS1 - magneticFieldAvailable()用法及代碼示例
- Arduino MKRWAN - available()用法及代碼示例
- Arduino ArduinoBLE - BLE.poll()用法及代碼示例
- Arduino ArduinoBLE - bleCharacteristic.hasDescriptor()用法及代碼示例
注:本文由純淨天空篩選整理自arduino.cc大神的英文原創作品 /* */。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。