How do I interrupt a python function?

Asked

Viewed 13 times

0

The problem is this: I want to make a function not make its execution complete if a certain condition is met.

Example:

a = 1
def function():
    if a is 1:
        pass #aqui seria o local onde que a função pararia
    print(a)

In the example, what I want to do is to print after if is not executed (the same way you break or continue in a repeat structure) if if if is True. I know I can do a little gambiarra to do what I want, but I wonder if there is nothing natural python to do this.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.