tags:

views:

81

answers:

1

Hi,

I'm trying to test my function "def" in a python shell, but when i paste it in there are errors. It seems not to like it when i have multiple return statements inside one "def".
For example:

def foo():
valid = True
if valid:
   return True
return False

Does anyone know why?

thanks!

+9  A: 

Your indentation is wrong. Should be this:

def foo():
    valid = True
    if valid:
        return True
    return False
Mark Byers
thanks......my bad
David Hsu