>= (greater than or equal

説明

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

構文

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

x: 変数。許容されるデータ型:int、float、double、byte、short、long。
y: 変数または定数。許可されたデータタイプ:int、float、double、byte、short、long。

プログラム例

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

注意点と警告

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

タイトルとURLをコピーしました