DekGenius.com
Team LiB   Previous Section   Next Section
and

Syntax

set myBoolean to (firstVal and secondVal)

Return value

boolean; true or false

Description

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

Table 4-2. Return Values of Expressions Using the and Operator

and Expression

Return Value

true and true

true

true and false

false

false and true

false; second expression is not evaluated

false and false

false; second expression is not evaluated

    Team LiB   Previous Section   Next Section