From: ts Date: 2001-04-19T20:43:46+09:00 Subject: [ruby-talk:13858] Re: local vars in case >>>>> "K" == K Kosako writes: K> From Guy Decoux <200104191053.f3JArsH28644@orsay1.moulon.inra.fr> >> [0,1].each {|n| >> print "n: #{n}\n" >> case n >> when 1 >> a = 0 >> print "a: #{a}\n" # => 0 >> when 0 >> b = 1 >> print "a: #{a}\n" # => "a: " (a == nil) >> print "b: #{b}\n" >> end >> } K> Here is the output. (patch was applied) K> n: 0 K> a: 0 K> n: 1 K> a: K> b: 1 Explain me the result :-) I've reversed the `when', normally I expect n: 0 a: b: 1 n: 1 a: 0 Guy Decoux