Yes, that is why that behaviour is known as closures.
Also why in languages like C++, you get to control what is captured from the calling context.