Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C#

How does the return statement know where to jump back to in the flow of the program? i.e. bread-crumb of some sort

Is this action handled similarly to exceptions and the call stack?

1 Answer

Michael Hulet
Michael Hulet
47,913 Points

The short answer is that it is the call stack. This is a bit of an oversimplification, but when you call a function, the computer hangs onto where it is in the function that's currently being run, and says "ok, I'm gonna do this work, and when I'm done, I'm gonna jump back here"