From: Carlos Date: 2004-05-20T23:42:59+09:00 Subject: Re: Zero is true ... whoda thunk? [Claus Spitzer , 2004-05-20 02.53 CEST] > On Thu, 20 May 2004 09:47:07 +0900, Nicholas Van Weerdenburg > wrote: > > > > nonzero? returned nil instead of false for me. Shouldn't it return false? > > 8< ----- snip ----- > > No. From the pickaxe: > > nonzero? num.nonzero? -> num or nil > > Returns num if num is not zero, nil otherwise. This behavior is useful > when chaining comparisons: > > a = %w( z Bb bB bb BB a aA Aa AA A ) > b = a.sort {|a,b| (a.downcase <=> b.downcase).nonzero? || a <=> b } > b � ["A", "a", "AA", "Aa", "aA", "BB", "Bb", "bB", "bb", "z"] But why shouldn't it return false instead of nil?