About return code in Python3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

About return code in Python3

what does "return" actually do besides returning results ?

28th Jul 2018, 7:12 AM
Hồng Vĩ
Hồng Vĩ - avatar
2 Answers
+ 1
That's exactly what it does, it returns a value or values. it's used to export data from a function
28th Jul 2018, 7:19 AM
JME
+ 1
Leave a function and return you to the point where you called the function from. At the bottom of the function code this would happen anyway, but if you want to leave a function in the middle, returning nothing (None), you can use it - just like 'break' to leave a loop.
28th Jul 2018, 7:24 AM
HonFu
HonFu - avatar