[Tutor] Help understanding part of the tutorial
Guess Who? Me
beercanz@hotmail.com
Sun Jan 5 03:15:01 2003
http://www.honors.montana.edu/~jjc/easytut/easytut/node9.html
contains this function:
def mult(a,b):
if b == 0:
return 0
rest = mult(a,b - 1)
value = a + rest
return value
print "3*2 = ",mult(3,2)
My question is that I don't get how mult(a,b-1) returns a value - can
somebody please explain? And it still works properly if you make a==0 - but
there is no "if a==0: return 0" statement. Any help would be appreciated.
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail