On 16.12.2013 09:49, Rafael Knuth wrote:
That's the tiny little detail I am confused about: What does return exactly do? Does it return only the first value within a loop or does it iterate through all values within a loop? (unless a given condition is met)
The return statement has nothing to do with loops. Whenever the Python interpreter gets to a return statement during the program execution it will immediately leave the current function and return to the caller.
"return" outside of a function doesn't work: >>> for i in range(10): ... return i ... File "<stdin>", line 2 SyntaxError: 'return' outside function Bye, Andreas _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor