What is the real function of 'return' and differance between print and return? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the real function of 'return' and differance between print and return?

10th Mar 2019, 11:26 AM
Jur`atbek Mahammadaliyev
Jur`atbek Mahammadaliyev - avatar
2 Answers
+ 8
Print will print somthing to the console "your screen" Return will return somthing back from were the function was called. For example: function name(par){ return par*par;} //now we call it name(here we pass 1 argument to the function the function will do somthing with it and return somthing back to this caller); and thats it 😉.
10th Mar 2019, 11:56 AM
D_Stark
D_Stark - avatar
+ 1
Thanks
10th Mar 2019, 12:07 PM
Jur`atbek Mahammadaliyev
Jur`atbek Mahammadaliyev - avatar