Definition. The boolean type

[comp1110-0P]

The type boolean is for values that may be either true or false. We can combine boolean values with the conjunction (&&) and disjunction (||) operators. The expression a && b is true exactly when both a and b are true. The expression a || b is true if at least one of a or b is true. We can also negate boolean values with the negation (!) operator. The guards of if statements and while loops are always expressions of type boolean.

bars magnifying-glass caret-down plus minus arrow-right xmark