Recursive function won't compile

Diez B. Roggisch deets at nospam.web.de
Wed Apr 2 17:00:28 EDT 2008


bc1891 at googlemail.com schrieb:
> #include <stdio.h>
> #include <stdlib.h>
> 
> def RecursiveFact(n):
>     if(n>1):
>         return n*RecursiveFact(n-1)
>     else:
>         return 1
> 
> fact = RecursiveFact(31)
> print fact
> 
> fact = "End of program"
> print fact
> 
> 
> ......but yet it still gives the right answer. How is this possible?

Given that you obviously don't use python, but some weird cross-breed 
beteween python and C - who are we to judge the semantics of that chimera?

Diez



More information about the Python-list mailing list