Regardless of whether you have a strict or non-strict or
it always gives the same answer given the same boolean values, so
True or True -> True
False or True -> True
True or False -> True
False or False -> False
The only case where the strictness matters is that if you have an expression A or B
where the B
sub-expression might a) take a long time (or even forever!) to calculate or b) potentially throw an exception.
A strict or
will always run the potentially long calculation whereas a non-strict or
can "short circuit" if the first parameter is True
and hence never evaluate the second parameter at all. This also means that if the second sub-expression throws an exception when it's evaluated you'll get a boolean table like this for strict or
:
True or <exception> -> <exception>
False or <exception> -> <exception>
But for non-strict or
you'll have
True or <exception> -> True
False or <exception> -> <exception>
Note that all of the above assumes that the non-strict or
is non-strict over its second parameter (like it is in Haskell and most other programming languages) but you could also have a non-strict or
that is non-strict for its first parameter.