Expect s[-1..-2] returns nil as s[-1..-3]. (bug ? it returns empty string
instead of nil.)
--
EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
A flower falls, even though we love it;
and a weed grows, even though we do not love it. --Dogen
I understand what you mean.
However, the return values should be consistent even if the range object
doesn't make sense.
> s[-1..-2] #=> ""
> s[-1..-3] #=> nil
How would you explain the inconsistency?
The only explanation I can think of is:
s[-1..-1] #=>"9"
s[-1..-2] #=>"", because one step back, one less character...
s[-1..-3] #=>nil, because there's no "less character" concept beyond empty
string.
Sam
"Ara.T.Howard" <ahoward@noaa.gov> wrote in message
news:Pine.LNX.4.60.0407211408090.19495@harp.ngdc.noaa.gov...
> EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
> PHONE :: 303.497.6469
> A flower falls, even though we love it;
> and a weed grows, even though we do not love it.
> --Dogen