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]) // true

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

 


Topic 121900, last updated on 18-Apr-2020