From: matz@... (Yukihiro Matsumoto) Date: 1999-07-01T16:29:42+09:00 Subject: [ruby-talk:00411] Re: New feature for Ruby? Hi, In message "[ruby-talk:00408] Re: New feature for Ruby?" on 99/07/01, Julian R Fondren writes: |> - Range::new(1, 9, -2) -- ERROR! |Perhaps you should try the latest version of ruby, the absolute value of |the third argument is used, and this works fine. Range::new() takes tree arguments in the latest, but the third argument is the boolean value to specify exclude last item, so that: Range::new(1,9,false) # 1<=n<=9; default Range::new(1,9,true) # 1<=n<9; |> The call "Range::new(1, 9)" or "Range::new(9, 1)" could also be |> written as "1..9" and "9..1" (perhaps we could have a global function |> "range" (like Python) which would instantiate Ranges via Range::new?). |This is already true. |``for x in 1..9; print "#{x}\n"; end'' works as expected But not for reverse order; for x in 9..1; print "#{x}\n"; end will not work as many (well, at least Clemens) expect. But I think Range is designed to be that way, i.e, no reverse order, option to exclude last element. I believe there can be something like Interval class which is like Smalltalk's Interval. matz.