Chapters
Python114 chapters

ReferenceKeywords

return

Ends a function and hands a value back to the caller.

Signature

return value

Returns

The value, or None for a bare return.

Example

Python
def check(n):
    if n < 0:
        return
    return "ok"

print(check(-1))
print(check(1))

Output

None
ok

See also