< =

[Comparison Operators]

説明

演算子の左側の変数と右側の値または変数を比較します。左側のオペランドが右側のオペランドより小さい(小さい)か等しい場合にtrueを返します。異なるデータ型の変数を比較することもできますが、予期しない結果が生じる可能性があるため、符号付き/符号なしの型を含め、同じデータ型の変数を比較することをお勧めします。

構文

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

媒介変数

x: 変数。許可されるデータ型: intfloatdoublebyteshortlong.
y: 変数または定数。許可されるデータ型: intfloatdoublebyteshortlong.

if (x <= y) { // tests if x is less (smaller) than or equal to y
  // do something only if the comparison result is true
}

ヒント

負の数は正の数より小さくなります。


Language Reference Home

86Duinoリファレンスのテキストは、Arduinoリファレンスを改変したもので、Creative Commons Attribution-ShareAlike 3.0ライセンスに基づいてライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

上部へスクロール