Junkone
10/19/2008 4:01:00 PM
so i cannot have a range that is decreasing in numbers. for eg
1..5 can be 1,2,3,4,5
how can i do 5..1 ie 5,4,3,2,1
On Oct 19, 4:14 am, Sebastian Hungerecker <sep...@googlemail.com>
wrote:
> Junkone wrote:
> > irb(main):025:0> (15..10).each do |n|
> > irb(main):026:1* print n
> > irb(main):027:1> end
> > => 15..10
>
> That doesn't work because 15..10 is an empty range.
>
> > irb(main):028:0> (5..10).each do |n|
> > irb(main):029:1* print n
> > irb(main):030:1> end
> > 5678910=> 5..10
>
> That does work. It did print the numbers right there in front of the =>
>
> HTH,
> Sebastian
> --
> Jabber: sep...@jabber.org
> ICQ: 205544826