Boolean operators
Boolean operations are very helpful to describe conditions, because
they always result in one of two values: true or false. BI# allows to combine
Boolean values by using the operators
and
,
or
, and
not
(!
).
This table shows how the operators work:
a | b | a and b | a or b | !a |
---|---|---|---|---|
true | true | true | true | false |
true | false | false | true | false |
false | true | false | true | true |
false | false | false | false | true |
This example shows how you can use these operators in BI#:
bool this_is_true = !false; int x = 42; bool greater_than_zero = x > 0; bool divisible_by_6 = greater_than_zero and (x % 6 == 0);