"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> There is problaly a really simple answer to this, but why does this
> function print the correct result but return "None":
> 
> def add(x, y):
>     if x == 0:
>         print y
>         return y
>     else:
>         x -= 1
>         y += 1
>         add(x, y)
> 
> print add(2, 4)
> 
> result:
> 6
> None

Perhaps this hint will help:

>>> print add(0,6)
6
6

-- 
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
        Of course a weed-puller isn't of much *use* in the Garden
        of Eden, but it takes a while to figure that out.
                                - Tim Peters


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to