Navigation

Operators and Keywords

Function List:

C++ API

: val = do_braindead_shortcircuit_evaluation ()
: old_val = do_braindead_shortcircuit_evaluation (new_val)
: do_braindead_shortcircuit_evaluation (new_val, "local")

Query or set the internal variable that controls whether Octave will do short-circuit evaluation of ‘|’ and ‘&’ operators inside the conditions of if or while statements.

This feature is only provided for compatibility with MATLAB and should not be used unless you are porting old code that relies on this feature.

To obtain short-circuit behavior for logical expressions in new programs, you should always use the ‘&&’ and ‘||’ operators.

When called from inside a function with the "local" option, the variable is changed locally for the function and any subroutines it calls. The original variable value is restored when exiting the function.

Package: octave