Logical Expressions
Logical expressions are those using the operators ! (for logical negation), && (the “and” operator), or || (the “or” operator). In logical expressions, a string that is not the null string or “0” (zero) is evaluated as true. The result of a logical operator is 1 for true and 0 for false. Short circuit expression evaluation is done for the “and” and “or” operators. This means that with the “and” operator (&&), evaluation ceases as soon as a false is found, for the expression must be false. Likewise, with the “or” operator (||), evaluation ceases as soon as a true is found, for the expression must be true.
Related Topics