Assignment functions whose last statement is a compound statement should return the value of the final expression of the active code path.
def f(x)=
if x:
# some code
x+1
else: 0
def f(x)=
match x:
case 0: -1
case _: x
def f(x)=
with open(x, "r"):
x.read()
Compiles to (3.10):
def f(x):
if x:
# some code
return x+1
else:
return 0
def f(x):
match x:
case 0: return -1
case _: return x
def f(x):
with open(x, "r"):
return x.read()
Assignment functions whose last statement is a compound statement should return the value of the final expression of the active code path.
Compiles to (3.10):