> =

[Comparison Operators]

描述

Compares the variable on the left with the value or variable on the right of the operator. Returns true when the operand on the left is greater (bigger) than or equal to the operand on the right. Please note that you may compare variables of different data types, but that could generate unpredictable results, it is therefore recommended to compare variables of the same data type including the signed/unsigned type.

語法

x >= y; // is true if x is bigger than or equal to y and it is false if x is smaller than y

參數

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

Example Code

if (x >= y) { // tests if x is greater (bigger) than or equal to y
  // do something only if the comparison result is true
}

Tip

Positive numbers are greater than negative numbers.


語法參考主頁面

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

發表評論

上部へスクロール