next up previous
Next: Comparison operators Up: Unit 04 Previous: The primitive data type

Expressions of type boolean

The following are simple expressions of type boolean:

Complex expressions can be constructed from simple boolean expressions using the boolean operators !, &&, and ||. For such operators, the following precedences hold:

  1. !
  2. &&
  3. ||

Example: The following is a correct expression of type boolean:

a || ! b && c
It is equivalent to:
a || ((! b) && c)


next up previous
Next: Comparison operators Up: Unit 04 Previous: The primitive data type