2014-10-19 14:00:51 -04:00
|
|
|
# test multi comparison operators
|
|
|
|
@micropython.viper
|
2020-03-22 22:26:08 -04:00
|
|
|
def f(x: int, y: int):
|
2014-10-19 14:00:51 -04:00
|
|
|
if 0 < x < y:
|
|
|
|
print(x, "<", y)
|
|
|
|
if 3 > x > y:
|
|
|
|
print(x, ">", y)
|
|
|
|
if 1 == x == y:
|
|
|
|
print(x, "==", y)
|
|
|
|
if -2 == x <= y:
|
|
|
|
print(x, "<=", y)
|
|
|
|
if 2 == x >= y:
|
|
|
|
print(x, ">=", y)
|
|
|
|
if 2 == x != y:
|
|
|
|
print(x, "!=", y)
|
|
|
|
|
2020-03-22 22:26:08 -04:00
|
|
|
|
2014-10-19 14:00:51 -04:00
|
|
|
f(1, 1)
|
|
|
|
f(2, 1)
|
|
|
|
f(1, 2)
|
|
|
|
f(2, -1)
|
|
|
|
f(-2, 1)
|