From: sto.mar@... Date: 2013-02-24T23:13:13+09:00 Subject: Re: Confusion with `nil` value being produced by IRB in case of Array#size manipulation. Am 24.02.2013 13:26, schrieb Love U Ruby: > Hans Mackowiak wrote in post #1098729: >> its because ruby does not make a difference in Array#[] if the element >> is nil or non existendt ... >> >> array = [nil] >> array[0] #=> nil >> >> array[1] #=> nil >> >> see? there is no difference and no error! > > Humm @Hans- > > I just noticed one point which is that, whenever Ruby finds an index > which is "out of index" , instead throwing an exception it only prints > `nil`.But yes it is the case only when we are reading the element from > an index which is still not present in the array. "Just noticed" ... you really must be kidding. This is *exactly* what is stated in the part of the documentation that I cited in my previous post, and even emphasized with stars (*), so that you could find it more easily. Here it is again: "Returns nil if the index (or starting index) are out of range." Note also that Ruby does not "print" nil, Array#[] _returns_ nil in that case. Next time, before insulting other people and making a complete fool out of yourself, do your research and reading more carefully. --