What's the difference between ECHO and RETURN ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the difference between ECHO and RETURN ?

18th Aug 2016, 7:56 PM
Francisco Astudillo Antinao
Francisco Astudillo Antinao - avatar
2 Answers
+ 2
ECHO: the content is written on the screen from inside the function. RETURN: the function writes nothing but returns a value to wherever it was called from. In these examples for beginners, the values that the function RETURNED are then ECHOed to make them visible, this makes them look similar, but functions are much more powerful, as I'm sure we'll see in later lessons. cheers
21st Aug 2016, 2:57 PM
Andres Mar
0
Echo is for display, while return is used to store a value, which may or may not be used for display or other use.
22nd Aug 2016, 12:37 PM
Jeremy Self
Jeremy Self - avatar