Please enable JavaScript to view this site.

 

The or operator takes 2 boolean expressions and returns true if either expression is true and false if neither is true.

bIsWorldWarOne = (nY in [1914..1918])
bIsWorldWarTwo = (nY in [1939..1945])
bIsWarYear = bIsWorldWarOne or bIsWorldWarTwo

You can use the or operator in more complex expressions:

bIsWarYear = (nY in [1914..1918]) or (nY in [1939..1945])

Note that the or operator also returns true if both expressions are true. If you want to use an operator in the context of one or the other but not both, then you should use the exclusive or, the xor operator.

 

See shortcut Boolean evaluation for how evaluation can stop once the result of an or expression is known.

 


Topic 121900, last updated on 16-Oct-2026