Re:If-then-else had to be invented
by DaiPlusPlus on Sunday December 13, 2020 @01:47PM
(#25408970)
VB.NET also uses “OrElse” and “AndAlso” for short-circuiting. VB6 didn’t support short-circuiting at all.
Re:If-then-else had to be invented
by MaxBarraclough on Sunday December 13, 2020 @05:53PM
(#25411249)
Good example, I'd forgotten about that.
On second thought I was mistaken about the example I gave. If someone says You can have tea OR coffee they're really expressing a NAND. You can have at most one out of the two options. Unlike with XOR, you're permitted to have neither.
To express XOR, you'd need to say You must have tea or coffee.
Somewhat related: the Ada language uses and, or, xor for its logical operators, but uses and then and or else for the short-circuit forms. [0] Not a very natural solution in my opinion.
[0] https://en.wikibooks.org/wiki/Ada_Programming/Operators#Shor...