From: gotoken@... (GOTO Kentaro) Date: 2000-03-23T11:44:34+09:00 Subject: [ruby-talk:02096] Re: Array Gotchas In message "[ruby-talk:02093] Re: Array Gotchas" on 00/03/22, "Dat Nguyen" writes: >Following was my exercise: > >Ruby> ary = [1, 2, 3, 4, 5] >Ruby> ary.each_index {|i| print i, "\n"} >0 >1 >2 >3 >4 >[1, 2, 3, 4, 5] >Ruby> (0..ary.size).each {|i| print i, "\n"} >0 >1 >2 >3 >4 >5 >0..5 I'm guessing you used eval.rb. This difference is not in Ruby but in eval.rb; eval.rb reports the value of each statement. Generally speaking, A statement returns a value in Ruby. Each last output line is the value of the statement, i.e., [1, 2, 3, 4, 5] is the value of `ary.each_index {|i| print i, "\n"}' 0..5 is the value of `(0..ary.size).each {|i| print i, "\n"}' -- gotoken PS. Should I use irb instead of eval.rb in User's guide?