我想找...

搜尋

分享

目錄

!=

[Comparison Operators]

描述

Compares the variable on the left with the value or variable on the right of the operator. Returns true when the two operands are not equal. 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 false if x is equal to y and it is true if x is not equal to y

參數

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

範例程式碼

if (x != y) { // tests if x is not equal to y
  // do something only if the comparison result is true
}

語法參考主頁面

86Duino 參考的文本是根據 知識共享署名-相同方式分享 3.0 許可證,部分文本是從 Arduino 參考 修改的。 參考中的代碼示例已發佈到公共領域。

返回頂端