This is the basic functionality of IRB. You enter an expression, it prints its value. In this case, the value is 1..5 . Another way out is just a side effect.
However, you can "minimize" the returned (and printed) value. So, instead of a large array of AR fat models, you can return something small.
Try something like this:
% irb 1.9.3p194 :001 > for a in 1..5 do 1.9.3p194 :002 > puts a 1.9.3p194 :003?> end; nil 1 2 3 4 5 => nil
source share