Exit if statement

PHOTO EMBED

Tue Apr 04 2023 04:10:02 GMT+0000 (Coordinated Universal Time)

Saved by @tofufu #python

def some_function():
    if condition_a:
        # do something and return early
        ...
        return
    ...
    if condition_b:
        # do something else and return early
        ...
        return
    ...
    return

if outer_condition:
    ...
    some_function()
    ...
content_copyCOPY

https://stackoverflow.com/questions/2069662/how-to-exit-an-if-clause