--- title: return tags: - python - functions - return aliases: - return statement - return keyword - none --- > [!note] Concept > The `return` keyword ends a function and sends back a value. Without it, a function will return `None`. > > > [!example] Explicit Return > > ```python > > def sub_two_nums(a, b): > > return a - b > > > > result = sub_two_nums(100, 49) > > print(result) # 51 > > ``` > > > [!example] Implicit Return (None) > > ```python > > def no_return_example(): > > x = 2 + 2 > > > > print(no_return_example()) # None > > ``` > > > [!important] Best Practices > > - Always use `return` when a function is expected to give a result. > > - Use `None` as a placeholder return value when the function’s main purpose is side effects. > > - Avoid mixing return types in the same function (e.g., returning both `int` and `None`). > > > [!info] Related Notes > > [[functions]] > > [[len()]] > > [[pythonSyntaxOverview]]