rabidpoobear at gmail.com
Wed Mar 19 11:03:42 CET 2008
elis aeris wrote:
> I actually said "ending" to avoid problems with different terminology
> between different languages - but i guess a return is still a return
> in python.
Return does not exit a program. A return statement denotes a point in a
function when the function will stop executing and the specified value
will be returned to the calling function.
In C++, a return in your main function will cause the program to stop
executing, because there was no calling function to give control back to.
> i did this search
> and it didn't return any particularly obvious answer.
There probably won't be a whole tutorial on a 'return' statement - it's
a fundamental part of functions and you should've picked up on it in any
tutorial discussing how to define functions.
> The funny thing is, i wrote that program last june and managed to not
> know/use a single return :)
This is not a good thing. You shouldn't have a function that is this
long. The entire point of functions is small snippets of reusable code
- having one massive function do everything negates the whole benefit of
functions. You may just as well have not put it in a function at all.
Where is this code, by the way? I didn't receive a copy of it.
More information about the Tutor