Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Logical operations with short-circuiting

`expr1 && expr2`

`expr1 || expr2`

`expr1 && expr2`

represents a logical `AND`

operation
that employs short-circuiting
behavior. That is, `expr2`

is not evaluated
if `expr1`

is logical `0`

(`false`

).
Each expression must evaluate to a scalar logical result.

`expr1 || expr2`

represents a logical `OR`

operation
that employs short-circuiting
behavior. That is, `expr2`

is not evaluated
if `expr1`

is logical `1`

(`true`

).
Each expression must evaluate to a scalar logical result.

Was this topic helpful?