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.