September 2013
Intermediate to advanced
548 pages
12h 25m
English
Short-circuit boolean expressions are boolean expressions whose arguments are evaluated only when necessary.
There are two “short-circuit” boolean expressions.
Expr1 orelse Expr2
This first evaluates Expr1. If Expr1
evaluates to true, Expr2 is not
evaluated. If Expr1 evaluates to false,
Expr2 is evaluated.
Expr1 andalso Expr2
This first evaluates Expr1. If Expr1
evaluates to true, Expr2 is evaluated. If
Expr1 evaluates to false, Expr2 is
not evaluated.
Note: In the corresponding boolean expressions (A or B;
A and B), both the arguments are always evaluated,
even if the truth value of the expression can be determined by
evaluating only the first expression.
Read now
Unlock full access