官术网_书友最值得收藏!

Relational operators

Relational operators are used to compare two operands. We have quite enough of these, ==, !=, >, <, >= and <=. Let's try them:

scala> val equal_op = 10 == 10
equal_op: Boolean = true

scala> val not_eq_op = 10 != 10
not_eq_op: Boolean = false

scala> val gt_than_op = 10 > 10
gt_than_op: Boolean = false

scala> val gt_than_op = 11 > 10
gt_than_op: Boolean = true

scala> val lt_than_op = 11 < 10
lt_than_op: Boolean = false

scala> val gt_eq_op = 11 >= 11
gt_eq_op: Boolean = true

scala> val lt_eq_op = 11 <= 11
lt_eq_op: Boolean = true

With these operators, we compare two operands for their values, and these operations yield a Boolean result.

主站蜘蛛池模板: 楚雄市| 长岛县| 宁德市| 泽州县| 宽甸| 新昌县| 德江县| 赣州市| 通城县| 清河县| 双鸭山市| 定安县| 万山特区| 博乐市| 泉州市| 万宁市| 孙吴县| 卓尼县| 玉门市| 当阳市| 武山县| 丰顺县| 化德县| 罗甸县| 龙游县| 蕉岭县| 内江市| 秦皇岛市| 错那县| 顺义区| 永济市| 黔南| 元朗区| 阿克陶县| 泰安市| 卢湾区| 禄劝| 临夏市| 来宾市| 呼和浩特市| 嘉荫县|