Closed sts10 closed 1 year ago
Is an "OR" operator ready to use? I tried | and it seems to work some of the time, but not always:
|
a = 22 if a < 10 | a > 20: print "a is NOT between 10 and 20" else: print "I don't know what a is"
I'd expect the above code to print "a is NOT between 10 and 20", but playground prints "I don't know what a is".
I'll note that the following works as expected:
a = 22 if a < 10: print "a is less than 10" if a > 20: print "a is greater than 20" else: print "I don't know what a is"
And thus I suspect this is an issue with the OR logic. Apologies if it's just not implemented yet -- it's not mentioned in the Docs at the moment.
Whoops, or operator seems to be just or. My bad.
or
Is an "OR" operator ready to use? I tried
|
and it seems to work some of the time, but not always:I'd expect the above code to print "a is NOT between 10 and 20", but playground prints "I don't know what a is".
I'll note that the following works as expected:
And thus I suspect this is an issue with the OR logic. Apologies if it's just not implemented yet -- it's not mentioned in the Docs at the moment.