From: dblack@... Date: 2006-07-10T00:30:25+09:00 Subject: Re: Sorting arrays Hi -- On Mon, 10 Jul 2006, Dark Ambient wrote: > On 7/9/06, dblack@wobblini.net wrote: >> >> Hi -- >> >> The only comparison with nil that you're doing is: >> >> lowest == nil > > > > But , from the output: > Comparing "five" (item) to nil (lowest) > Either lowest is nil, or "five" is less than nil > So lowest is now being set to "five" > > The code on the right of the || only gets executed if lowest == nil is >> false. > > > How can it be false on first pass, since it's declared lowest = false ? I don't see that in your code. I see this: lowest = nil So this: lowest == nil is true. David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy http://www.manning.com/black => RUBY FOR RAILS, the Ruby book for Rails developers http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log dblack@wobblini.net => me