T
Todd Benson
Why does this not do what I expect?
irb(main):001:0> RUBY_VERSION
=> "1.9.2"
irb(main):002:0> (0..3).inject {|s, i| a = i%2 == 0 ? 1 : -1; p a}
-1
1
-1
=> -1
I would think the result should be
1
-1
1
-1
=> -1
Todd
irb(main):001:0> RUBY_VERSION
=> "1.9.2"
irb(main):002:0> (0..3).inject {|s, i| a = i%2 == 0 ? 1 : -1; p a}
-1
1
-1
=> -1
I would think the result should be
1
-1
1
-1
=> -1
Todd