[Tutor] recursion surprise
Marc Tompkins
marc.tompkins at gmail.com
Sun Jun 9 02:15:17 CEST 2013
On Sat, Jun 8, 2013 at 4:52 PM, Jim Mooney <cybervigilante at gmail.com> wrote:
> Well, I thought
>
> if num > 10:
> return num
>
> Was a return statement. Num does become > 10. You mean I need more than
> one?
>
It is, and you actually have more than one. All functions return None,
unless you explicitly specify a return value (via a return statement).
Whenever your execution path does NOT go through your return statement - in
other words, if num is NOT greater than 10 - execution falls off the end
and the function returns None.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130608/9d9b2718/attachment.html>
More information about the Tutor
mailing list