andExpression orExpression (Two Argument Boolean Operations)

These provide the logical and and the logical or operators. Both are cut-off operations, that is: with and, if the left-hand-side is false then the value is known to be false, so the right-hand-side is not evaluated; with or, if the left-hand-side is true then the value is known to be true, so the right-hand-side is not evaluated

Figure 6.20. orExpression

orExpression

Figure 6.21. andExpression

andExpression

Table 6.3. Binary Logical Operators

 OperatorMeaning Operand TypesResult Type
orLogical orBoolean or BooleanBoolean
andLogical andBoolean and BooleanBoolean

For example:

var inRange : Boolean = (x >= 0) and (x <= 100);
var done : Boolean = (timeRemaining <= 0ms) or cancelled;

Because of type inference, these variables don't need to be explicitly declared as Boolean.