From: Phrogz Date: 2007-06-29T00:15:02+09:00 Subject: Re: Array Problem, sort Array On Jun 28, 7:53 am, John Joyce wrote: > > # On Jun 27, 10:17 pm, Pe�a, Botp wrote: > > # > irb(main):013:0> [nil].sort > > # > => [nil] > > Let's do some philosophy! > But if an array has only one element and the element is nil, is it > really an array? > It is an object of Class Array. > Well, it must be an array. Of course it's an Array. And (unlike Lua) it is an Array with exactly 1 object in it. The fact that that object happens to be a member of NilClass is no different than objects of TrueClass or Fixnum or yet another Array. [nil] != [] [1,nil] != [1] [1,nil,2] != [1,2] It's more than the fact that Ruby thinks they're different. They have completely different, distinct, well-defined meanings.