<br><div><span class="gmail_quote">On 18 Nov 2005 06:30:58 -0800, <b class="gmail_sendername"><a href="mailto:martin.clausen@gmail.com">martin.clausen@gmail.com</a></b> <<a href="mailto:martin.clausen@gmail.com">martin.clausen@gmail.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">> I still don't get it. I tried to test with x = 0 and found that to
</blockquote><div><br>
Informative print statements can help you to see and understand 
the program flow, especially if the problem is conceptual,  with
no *real*  errors in your "script"<br>
<br>
def add(x, y):<br>
    print 'P1:', x,y<br>
    if x == 0:<br>
        print 'P2:', y<br>
        return y<br>
    else:<br>
        x -= 1<br>
        y += 1<br>
        print "P3:",x,y<br>
        add(x, y)<br>
        print "p4"<br>
    print 'P5'<br>
    #implied return is here, so I will add it <br>
    return # returns None **to the next level up**<br>
<br>
print add(2, 4) <br>
</div><br>
>>> reload(addtest)<br>
P1: 2 4<br>
P3: 1 5<br>
P1: 1 5<br>
P3: 0 6<br>
P1: 0 6<br>
P2: 6<br>
p4<br>
P5<br>
p4<br>
P5<br>
None<br></div>