0
In python can we call an operation of a function after the return statement?
Answer please with an example
1 Answer
0
every operation after the return statement in the same scope is omitted:
def test():
print("yey")
return None
print("Nope")
test()
will give you only "yey"
But if you have conditional operators, then this code:
def test(a=0):
print("yey")
if a==1:
return None
else:
print("Nope")
test(5)
will give you both "yey" and "Nope"