Hi -- On Mon, 10 Jul 2006, Dark Ambient wrote: > On 7/9/06, dblack / wobblini.net <dblack / wobblini.net> wrote: > >> I don't see that in your code. I see this: >> >> lowest = nil >> >> So this: >> >> lowest == nil >> >> is true. > > > Sorry I'm not trying to be frustrating. > > def sort(list) > sorted = [] > unsorted = [] > > lowest = nil <----------- here lowest is being set to nil > list.each do |item| > if lowest == nil || item < lowest <----then expression 1 is true (as you > say above). Correct. Therefore this gets executed: > lowest = item So now, lowest is item -- which was "five" (or whatever the first array item was). So *next* time through the loop, this: lowest == nil will *not* be true. So this: item < lowest will be tested instead. 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