>

[Comparison Operators]

説明

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

構文

x > y; // is true if x is bigger than y and it is false if x is equal or smaller than y

媒介変数

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

if (x > y) {  // tests if x is greater (bigger) than y
  // do something only if the comparison result is true
}

ヒント

正の数は負の数よりも大きいです。


Language Reference Home

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

上部へスクロール