*=

[Compound Operators]

描述

This is a convenient shorthand to perform multiplication of a variable with another constant or variable.

語法

x *= y; // equivalent to the expression x = x * y;

參數

X: variable. Allowed data types: intfloatdoublebyteshortlong.
y: variable or constant. Allowed data types: intfloatdoublebyteshortlong.

Example Code

x = 2;
x *= 2; // x now contains 4

參考

  • [程式語法] Normal Multiplication

語法參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール