Python return Keyword
Example
Exit the function and return the sum:
def myfunction(): return 5+5 print(myfunction())
Definition and Usage
The return keyword is used to exit the function and return a value.
More Examples
Example
The statements after the return line will not be executed:
def myfunction(): return 5+5 print("Hello, World!") print(myfunction())
related pages
Use the keyword def Define a function.
Please visit our Python Functions Tutorial Learn more about functions in Chinese.