Dynamic Scoping: Example
. Consider the following program
program dynamic (input, output);
var r: real;
procedure show;
begin write(r) end;
procedure small;
var r: real;
begin r := 0.125; show end;
begin
r := 0.25;
show; small; writeln;
show; small; writeln;
end.
Consider the example shown to illustrate that the output depends on whether lexical or dynamic scope is used.
|