Mar-10-2019, 04:59 PM
Thanks, Archie. I'm not sure I completely follow, though.
Docs says:
x or y
if x is false, then y, else x
(1) This is a short-circuit operator, so it only evaluates the second argument if the first one is false.
So if I'm reading this correctly,
Also, I put parentheses around ("/" or "*") to hopefully show the scope of OR but it evaluates the same either way
Docs says:
x or y
if x is false, then y, else x
(1) This is a short-circuit operator, so it only evaluates the second argument if the first one is false.
So if I'm reading this correctly,
var = "*" print(var == ("/" or "*")) # var == "/" is False, so it will evaluate var == "*" which is True, making the whole statement True print(var == ("*" or "/")) # var == "*" is True, so the statement is True
Also, I put parentheses around ("/" or "*") to hopefully show the scope of OR but it evaluates the same either way