当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Arduino ==用法及代码示例


[比较运算符]

说明

将左侧的变量与运算符右侧的值或变量进行比较。当两个操作数相等时返回真。请注意,您可以比较不同数据类型的变量,但这可能会产生不可预测的结果,因此建议比较相同数据类型的变量,包括有符号/无符号类型。

用法

x == y; // is true if x is equal to y and it is false 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 equal to y
  // do something only if the comparison result is true
}

相关用法


注:本文由纯净天空筛选整理自arduino.cc大神的英文原创作品 ==。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。