Boolean Values and Logical
Operators
Python |
Java |
The type boolean includes the constant values True and False (note capitalization). Other values, such as 0, '', [], and None, also mean False.
Practically any other value also means True. The logical operators
are not, and, and or. Compound Boolean
expressions consist of one or more Boolean operands and a logical
operator. Short-circuit
evaluation stops when enough information is available to return a value. not is evaluated before and, which is evaluated before or. |
The type boolean includes the constant values true and false. The logical operators
are ! (not) && (and), and || (or). Compound Boolean
expressions consist of one or more Boolean operands and a logical
operator. Short-circuit
evaluation stops when enough information is available to return a value. ! is evaluated before &&, which is evaluated before ||. |