Logical Operators: Short-Circuit && ||
Logical operations with short-circuiting
Syntax
expr1 && expr2
expr1 || expr2
Description
expr1 && expr2
represents a logicalAND
operation that employsshort-circuiting behavior. That is,expr2
is not evaluated ifexpr1
is logical0
(false
). Each expression must evaluate to a scalar logical result.
expr1 || expr2
represents a logicalOR
operation that employsshort-circuiting behavior. That is,expr2
is not evaluated ifexpr1
is logical1
(true
). Each expression must evaluate to a scalar logical result.
Examples
More About
Was this topic helpful?