News for hackers. Stuff that matters.
Re:Ask HN: How does the return statement of a function work? by aristofun on Monday April 10, 2023 @10:20AM (#35512641)
In short it’s called a call stack - returned value (not the variable) is what is left of the function for the “outer” function.

And because finished function is removed from stack - all its variables are gone with it.

There are no comments on this comment yet.