當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Arduino --用法及代碼示例

[複合運算符]

說明

將變量的值減 1。

用法

x--; // decrement x by one and returns the old value of x
--x; // decrement x by one and returns the new value of x

參數

x:變量。允許的數據類型:intlong(可能是無符號的)。

返回

變量的原始值或新遞減值。

示例代碼

x = 2;
y = --x;  // x now contains 1, y contains 1
y = x--;  // x contains 0, but y still contains 1

相關用法


注:本文由純淨天空篩選整理自arduino.cc大神的英文原創作品 --。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。