[Compound Operators]
描述
This is a convenient shorthand to perform division of a variable with another constant or variable.
語法
x /= y; // equivalent to the expression x = x / y;
參數
X
: variable. Allowed data types: int
, float
, double
, byte
, short
, long
.y
: non zero variable or constant. Allowed data types: int
, float
, double
, byte
, short
, long
.
範例程式碼
x = 2; x /= 2; // x now contains 1
參考
- [程式語法] Normal Division
語法參考主頁面
86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。