Python return Keyword
Example
Exit a function and return the sum:
def myfunction():
return 3+3
print(myfunction())
Try it Yourself »return 3+3
print(myfunction())
Definition and Usage
Thereturn keyword is to exit a function and return a value.
More Examples
Example
Statements after the return line will not be executed:
def myfunction():
return 3+3
print("Hello, World!")
print(myfunction())
Try it Yourself »return 3+3
print("Hello, World!")
print(myfunction())
Related Pages
Define a function using the keyworddef.
Read more about functions in ourPython Functions Tutorial.

