「Scala」関係演算子のサンプル
書式
演算子 例 意味 > a > b aがbより大きいか >= a >= b aがb以上か < a < b aがbより小さいか <= a <= b aがb以下か == a == b aとbが等しいか != a != b aとbが等しくないか
使用例
object Test { def main(args: Array[String]) { var a = 10; var b = 20; println("a == b = " + (a == b) ); println("a != b = " + (a != b) ); println("a > b = " + (a > b) ); println("a < b = " + (a < b) ); println("b >= a = " + (b >= a) ); println("b <= a = " + (b <= a) ); } }
実行結果
$ scalac Test.scala
$ scala Test
a == b = false
a != b = true
a > b = false
a < b = true
b >= a = true
b <= a = false