From: 7stud -- Date: 2011-03-31T03:08:05+09:00 Subject: Re: string/array slices Patrick Tyler wrote in post #990031: > Hello, > > I know that this has been covered a bit here: > http://www.ruby-forum.com/topic/186437 but I'm still not certain that I > understand. > > s = "foo" > > s[3] is nil, like I would expect. > > s[3,0] is "", instead of nil. That behaviour is contrary to the description in the 1.9.2 docs here: http://www.ruby-doc.org/core/classes/Array.html which say: Returns nil if the index (or starting index) are out of range. Because 3 is out of range, s[3,0] should return nil according to the docs. -- Posted via http://www.ruby-forum.com/.