On 22/08/18 11:29, Rafael Knuth wrote:

> my code below did not require a return statement, hence I was assuming
> it wouldn't be needed in my function either.

return is only used inside a function, it makes no
sense outside (and is a syntax error). Its purpose
is to return a value to the caller of the function.

Any time you want to get a value back from a function
you must use return (or the slightly more esoteric 'yield')
Otherwise you will receive the default return value of None.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to