You can create small pieces of code that we call "function". Those function take a few input that we call "arguments" or "parameters". They execute whenever they are meant to do... and usually return an output we call "result".
An example of function is "distance". It takes two coordinates as input and compute the distance between those coordinates and returns said distance.
So that does the return do in programming? It terminate the function it's in, and takes an optional argument which is the return value of the function.
surfmaths t1_j2f2asv wrote
Reply to ELI5. What does "return" do in programming? I read about it a lot and still dont understand the purpose. by BlendsLoL
You can create small pieces of code that we call "function". Those function take a few input that we call "arguments" or "parameters". They execute whenever they are meant to do... and usually return an output we call "result".
An example of function is "distance". It takes two coordinates as input and compute the distance between those coordinates and returns said distance.
So that does the return do in programming? It terminate the function it's in, and takes an optional argument which is the return value of the function.