Team LiB   Previous Section   Next Section
or

Syntax

set theTruth to (intVar1 > intVar2) or ("index.html" contains ".html")

Return value

boolean; true or false

Description

or is a logical operator that takes two boolean operands, true or false. The or expression returns true if either operand evaluates to true. If the first operand (the one on the left of the or operator) evaluates to true then the second operand is not evaluated, because the or expression returns true if any of its operands is true (the expression is "short-circuited"). The or operator does not have any equivalent symbols (|, ||), as in Perl or JavaScript. Table 4-3 shows the different combinations that you can use with or and the resulting expression values.

Table 4-3. Return Values of Expressions Using the or Operator

or Expression

Return Value

true or true

true

true or false

true; second expression is not evaluated

false or true

true

false or false

false

    Team LiB   Previous Section   Next Section