當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Arduino !=用法及代碼示例

[比較運算符]

說明

將左側的變量與運算符右側的值或變量進行比較。當兩個操作數不相等時返回真。請注意,您可以比較不同數據類型的變量,但這可能會產生不可預測的結果,因此建議比較相同數據類型的變量,包括有符號/無符號類型。

用法

x != y; // is false if x is equal to y and it is true if x is not equal to y

參數

x: 多變的。允許的數據類型:int,float,double,byte,short,long.
y: 變量或常量。允許的數據類型:int,float,double,byte,short,long.

示例代碼

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

相關用法


注:本文由純淨天空篩選整理自arduino.cc大神的英文原創作品 !=。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。