Home > Blockchain >  Is return none necessary if not used does it break the code?
Is return none necessary if not used does it break the code?

Time:06-05

Is return none necessary? if not used what will happen does it keep returning variables and commands etc? thank you for the help

CodePudding user response:

No, return statements are not necessary in a Python function.

If there is no return statement, Python will implicitly return none when it reaches the end of the function.

CodePudding user response:

in python. if you do not return anything, it will automatically (implicitly) return None. you can test that by making a function like

def fun():
    pass

then you can print that function

print(fun())

you will see that it will output None. Thus, it is not a must to return None

  • Related