|
Logical OperatorsYorick supports C-style logical AND and OR operators. Unlike the arithmetic and comparison operators, these take only scalar operands and return a scalar int result. Their precedence is between | and =. The right operand is not evaluated at all if the value of the left operand decides the result value; hence the left operand may be used to determine whether the evaluation of the right operand would lead to an error. && logical and (scalar int result)
The logical NOT operator takes an array or a scalar operand, returning int 1 if the operand was zero, 0 otherwise. Its precedence is above ^. ! logical not (int result) The ternary operator selects one of two values based on the value of a scalar condition: condition ? true_expr : false_expr Its precedence is low, and it must be parenthesized in a function argument list or an array index list to prevent confusion with the : in the index range syntax. Like && and ||, the expression which is rejected is not evaluated at all. |