From: Eleanor McHugh Date: 2009-05-09T08:47:01+09:00 Subject: Re: ruby string slice/[] w/ range, weird end behavior On 9 May 2009, at 00:39, Sebastian Hungerecker wrote: > Am Samstag 09 Mai 2009 01:32:06 schrieb Eleanor McHugh: >> "foo"[3..3] => nil > > You sure? I get "", same as the op. If it would return nil, I don't > think the > op would have asked his question. Sorry, typo on my part (I'm not having a good week for these it seems). The point I was trying to make was that "foo"[3..3] => "" is a thoroughly valid range, but I guess that would have been clearer with a fuller explanation. Consider "foo"[2..3] => "o" index [3] is actually the end of the string so whilst the range accesses the string after any characters in it, it's still accessing the string in a valid range. Ellie Eleanor McHugh Games With Brains http://slides.games-with-brains.net ---- raise ArgumentError unless @reality.responds_to? :reason