Spec-Zone .ru
спецификации, руководства, описания, API

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

 Operator Meaning  Operand Types Result Type
or Logical or Boolean or Boolean Boolean
and Logical and Boolean and Boolean Boolean

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.