mercredi 16 mai 2018

How to check which return statement was executed in a function?

Hi i have a simple function:

def check_val(val):
    if value < 10:
        previous = value
        return previous
    else:
        current  = value + 10
        return current

a = check_val(3)

How can I know if current or previous was returned?

Aucun commentaire:

Enregistrer un commentaire