Short-Circuit AND, &&
Logical AND with short-circuiting
Syntax
Description
represents a logical expr1 && expr2AND operation that employs Logical Short-Circuiting behavior. That is, expr2 is not evaluated if expr1
is logical 0 (false). Each expression must evaluate to
a scalar logical result.
Examples
Input Arguments
More About
Tips
When you use the element-wise
&and|operators in the context of aniforwhileloop expression (and only in that context), they use short-circuiting to evaluate expressions.However, you should always use the
&&and||operators to enable short-circuit evaluation. Using the&and|operators for short-circuiting can yield unexpected results when the expressions do not evaluate to logical scalars.
Extended Capabilities
Version History
Introduced before R2006a