I remember encountering a language that has &&
and ||
for boolean logic, but also and
and or
keywords that have a special purpose.
Something like a = b and print "correct"
would set a
equal to b
, and then if b
was true it would print "correct" without attempting to set a
equal to the result of print
. Kinda like:
a = b
if (b) print "correct"
Likewise, or
meant "if false do this thing without affecting the result", thus...
a = b or print_fail_message()
...was effectively identical to...
a = b
if (!b) print_fail_message()
The bit after the and
or or
did not change the value of the preceding code. I can't remember what language it was.