Skip to content

Python Return Statement

Syntax

The return statement in Python is used to exit a function and optionally return a value to the caller.

def function_name():
# Code to execute
return value
# Call function
function_name()

Example

def say_hello():
return 'Hello World'
print(say_hello())
# Output: Hello World