– – (decrement)

[Compound Operators]

説明

変数の値を 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 (possibly unsigned).

戻り値

変数の元の値または新しく減分された値。

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

Language Reference Home

86Duinoリファレンスのテキストは、Arduinoリファレンスを改変したもので、Creative Commons Attribution-ShareAlike 3.0ライセンスに基づいてライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

上部へスクロール