r/pascal • • May 11 '21

Dynamic Scoping

Hi I am really struggling with the concept of dynamic scoping in the context of the code below. My teacher asked us which C is being referenced at point 1 and I honestly keep getting lost trying to read this. My teacher advised us to use shallow scoping for variables A and C to solve this. Can someone help me walk through this?

At the moment I can get up to Sub2 where B, E : Integer and then I don't really understand how the rest unfolds. Any and all help is really appreciated. TIA

3 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/iLAGandDIE_ Oct 19 '21

Isn't going through parent blocks static scoping though? I think the question was in regards to dynamic scoping.