>>>>> "Y" == Yukihiro Matsumoto <matz / ruby-lang.org> writes:

Y> "1", with warning.

 Something like this ?

pigeon% cat b.rb
#!./ruby
def a(b := 'ff')
   b, i := 12, 24
   [1, 2].each do |i|
      b = i;  b *= 2; p b
      b := i; b *= 4; p b
   end
   p b, i
end

a
pigeon% 

pigeon% b.rb
./b.rb:2: warning: useless use of `:='
./b.rb:3: warning: useless use of `:='
./b.rb:4: warning: shadowing variable `i'
./b.rb:6: warning: shadowing variable `b'
2
4
4
8
4
24
pigeon% 

pigeon% make test | wc -l
make: *** [test] Error 1
    254
pigeon% make test | tail 
make: *** [test] Error 1
/h/nblg/ts/ruby/ts/r17/var/ruby/sample/test.rb:985: warning: shadowing variable `i'
/h/nblg/ts/ruby/ts/r17/var/ruby/sample/test.rb:991: warning: shadowing variable `i'
/h/nblg/ts/ruby/ts/r17/var/ruby/ext/syslog/test.rb:69: warning: shadowing variable `param'
/h/nblg/ts/ruby/ts/r17/var/ruby/ext/tk/lib/tk.rb:1420: warning: shadowing variable `elem'
/h/nblg/ts/ruby/ts/r17/var/ruby/ext/tk/lib/tk.rb:1531: warning: shadowing variable `conf'
/h/nblg/ts/ruby/ts/r17/var/ruby/ext/tk/lib/tk.rb:1590: warning: shadowing variable `conf'
/h/nblg/ts/ruby/ts/r17/var/ruby/ext/tk/lib/tk.rb:3718: warning: shadowing variable `slot'
/h/nblg/ts/ruby/ts/r17/var/ruby/ext/tk/lib/tk.rb:3718: warning: shadowing variable `value'
not ok iterator 5 -- /h/nblg/ts/ruby/ts/r17/var/ruby/sample/test.rb:584
test failed
pigeon% 

pigeon% ruby -c lib/matrix.rb 
lib/matrix.rb:598: warning: shadowing variable `i'
lib/matrix.rb:657: warning: shadowing variable `i'
Syntax OK
pigeon% 


Guy Decoux