You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
353 B
21 lines
353 B
# test comparison operators
|
|
@micropython.viper
|
|
def f(x:int, y:int):
|
|
if x < y:
|
|
print(x, "<", y)
|
|
if x > y:
|
|
print(x, ">", y)
|
|
if x == y:
|
|
print(x, "==", y)
|
|
if x <= y:
|
|
print(x, "<=", y)
|
|
if x >= y:
|
|
print(x, ">=", y)
|
|
if x != y:
|
|
print(x, "!=", y)
|
|
|
|
f(1, 1)
|
|
f(2, 1)
|
|
f(1, 2)
|
|
f(2, -1)
|
|
f(-2, 1)
|
|
|