当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


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大神的英文原创作品 --。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。