The LOGICAL_OR function performs a logical OR operation on its arguments. It returns True (1) if either of its arguments are non-zero (non-NULL for strings and heap variables), and False (0) otherwise.
The LOGICAL_OR function is similar to the OR operator, except that it performs a logical "or" rather than a bitwise "or" on its arguments.
| Note |
Unlike the || operator, LOGICAL_OR accepts multi-element arrays as its arguments. In addition, where the || operator short-circuits if it can determine the result by evaluating only the first argument, all arguments to a function are always evaluated.
Result = LOGICAL_OR(Arg1, Arg2)
Integer zero (false) or one (true) if both operands are scalars, or an array of zeroes and ones if either operand is an array.
The expressions on which the logical OR operation is to be carried out. The arguments can be scalars or arrays of any type other than structure.
This routine is written to make use of IDL's thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the
At the IDL Command Line, enter:
PRINT, LOGICAL_OR(2,4), LOGICAL_OR(2,0), LOGICAL_OR(0,4), $ LOGICAL_OR(0,0)
IDL Prints:
1 1 1 0
Introduced: 6.0
Logical Operators, Bitwise Operators, LOGICAL_AND, LOGICAL_TRUE