From: Michael Guterl Date: 2008-10-19T08:48:52+09:00 Subject: Re: prob with ranges On Sat, Oct 18, 2008 at 7:29 PM, Junkone wrote: > i looked at an example > rng.each {| i | block } -> rng > > Iterates over the elements rng, passing each in turn to the block. > > (10..15).each do |n| > print n, ' ' > end > > > produces: 10 11 12 13 14 15 > > > > > > when i try the same, it does not work. here is my attempt. > irb(main):025:0> (15..10).each do |n| > irb(main):026:1* print n > irb(main):027:1> end > => 15..10 > irb(main):028:0> (5..10).each do |n| > irb(main):029:1* print n > irb(main):030:1> end > 5678910=> 5..10 > irb(main):031:0> > yes it does, you just forgot the separator in your call to print (5..10).each do |n| print n, ' ' end puts n will give you a newline.