Last modified on 25 July 2008, at 10:31

Ruby Programming/Object/NilClass

i0 = 1
loop {
  i1 = 2
  print defined?(i0), "\n"      # true; "i0" was initialized in the ascendant block
  print defined?(i1), "\n"      # true; "i1" was initialized in this block
  break
}
print defined?(i0), "\n"        # true; "i0 was initialized in this block
print defined?(i1), "\n"        # false; "i1" was initialized in the loop