kuroko/test/testTernary.krk
2021-01-07 14:04:42 +09:00

20 lines
323 B
Python

def foo():
print("Called foo")
return 42
def bar():
print("Called bar")
return "a string"
let x = foo() if True else bar()
print(x)
let y = foo() if False else bar()
print(y)
let z = foo() if y == "a string" else bar()
print(z)
let l = (lambda x: x * 72) if x == 42 else (lambda y: y - 48)
print(l(x))