title: Static and Dynamic Scoping Problem
body: <p>I'm solving following code in Static and Dynamic Scoping.
  I got following answer but I need someone to confirm if I'm correct or not since I'm a bit confusing. I really appreciate if anyone can explain in simple way!</p>
  
  <pre><code>Static  =&gt; (1)8  (2)27
  Dynamic =&gt; (1)10 (2)27
  
  proc main
  var x,y,z;
      proc sub1
          var x,z
          x := 6;
          z := 7;
          sub2;
          x := y*z + x;
          print(x);   ---- (2)
      end;
      proc sub2
          var x,y
          x := 1;
          y := x+z+2;
          print(y);   ---- (1)
      end;
  begin
      x := 1; y:=3; z:=5;
      sub1;
  end 
  </code></pre>