From ba06b1a81f81e089849c7c877eba7b1d3618b126 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 7 Apr 1998 08:34:10 +0000 Subject: dynamic (nested) local variables git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/test.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sample') diff --git a/sample/test.rb b/sample/test.rb index 98c913667a..29670987fa 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -638,14 +638,14 @@ ok($proc.call(2) == 4) ok($proc.call(3) == 6) proc{ - iii=5 # dynamic local variable + iii=5 # nested local variable $proc = proc{|i| iii = i } $proc2 = proc { - $x = iii # dynamic variables shared by procs + $x = iii # nested variables shared by procs } - # scope of dynamic variables + # scope of nested variables ok(defined?(iii)) }.call ok(!defined?(iii)) # out of scope @@ -653,6 +653,7 @@ ok(!defined?(iii)) # out of scope $x=0 $proc.call(5) $proc2.call +p $x ok($x == 5) if defined? Process.kill @@ -715,8 +716,8 @@ def test_ev end $x = test_ev -ok(eval("local1", $x) == "local1") # static local var -ok(eval("local2", $x) == "local2") # dynamic local var +ok(eval("local1", $x) == "local1") # normal local var +ok(eval("local2", $x) == "local2") # nested local var $bad = true begin p eval("local1") -- cgit v1.2.3