From: Eleanor McHugh Date: 2009-05-09T08:50:22+09:00 Subject: Re: ruby string slice/[] w/ range, weird end behavior On 9 May 2009, at 00:44, RubyTalk@gmail.com wrote: > Element Reference—If passed a single Fixnum, returns the code of the > character at that position. If passed two Fixnum objects, returns a > substring starting at the offset given by the first, and a length > given by the second. If given a range, a substring containing > characters at offsets given by the range is returned. In all three > cases, if an offset is negative, it is counted from the end of str. > Returns nil if the initial offset falls outside the string, the length > is negative, or the beginning of the range is greater than the end. > > two fixed numbers returns a substring. The same result would occur with "foo"[3,1] => "" "foo"[4,1] => nil Ellie Eleanor McHugh Games With Brains http://slides.games-with-brains.net ---- raise ArgumentError unless @reality.responds_to? :reason