[比较运算符]
说明
将左侧的变量与运算符右侧的值或变量进行比较。当两个操作数不相等时返回真。请注意,您可以比较不同数据类型的变量,但这可能会产生不可预测的结果,因此建议比较相同数据类型的变量,包括有符号/无符号类型。
用法
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 !用法及代码示例
- Arduino long用法及代码示例
- Arduino Arduino_EMBRYO_2 - setLengthXY()用法及代码示例
- Arduino ~用法及代码示例
- Arduino ArduinoBLE - bleDevice.advertisedServiceUuidCount()用法及代码示例
- Arduino const用法及代码示例
- Arduino Ethernet - server.begin()用法及代码示例
- Arduino ArduinoBLE - BLEService()用法及代码示例
- Arduino digitalWrite()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.subscribe()用法及代码示例
- Arduino Servo - attach()用法及代码示例
- Arduino write()用法及代码示例
- Arduino Arduino_LSM9DS1 - readGyroscope()用法及代码示例
- Arduino ArduinoSound - FFTAnalyzer.input()用法及代码示例
- Arduino MKRGSM - gprs.attachGPRS()用法及代码示例
- Arduino WiFiNINA - WiFi.config()用法及代码示例
- Arduino MKRGSM - sms.read()用法及代码示例
- Arduino MKRNB - getCurrentCarrier()用法及代码示例
- Arduino Scheduler - Scheduler.startLoop()用法及代码示例
- Arduino Arduino_LSM9DS1 - magneticFieldAvailable()用法及代码示例
- Arduino MKRWAN - available()用法及代码示例
- Arduino ArduinoBLE - BLE.poll()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.hasDescriptor()用法及代码示例
- Arduino Ethernet - EthernetUDP.parsePacket()用法及代码示例
- Arduino WiFi101 - WiFi.subnetMask()用法及代码示例
注:本文由纯净天空筛选整理自arduino.cc大神的英文原创作品 !=。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。