title: Pascal static and dynamic scope prob?
body: <p>If pascal was using dynamic scope what it would be the result of this code ??
  By using the static scope i get those results!
  x=32 , y=39 and z=105</p>
  
  <pre><code>program what(output);
  
  var 
    y, z: integer;
  
  procedure p(x, z: integer);
  
    procedure a(y: integer);
    begin (* of procedure a *)
      writeln(x, y, z);
      x := x + 5;
    end;
  
    procedure b(x:integer);
    begin (* of procedure b *)
      writeln(x, y, z);
      y := y + 2;
      a(x + 7);
    end;
  begin (* of procedure p *)
    b(32);
    writeln(x, y, z);
    a(47);
    writeln(x, y, z);
  end;
  
  procedure q(x,y:integer);
  begin (* of procedure q *)
    p(x + 4, x + y);
    writeln(x, y, z);
  end;
  
  begin (* of program what *)
    y := 21; 
    z := 105; 
    q(y + 1, y + z);
    writeln(y, z);
  end.
  </code></pre>