From: Dark Ambient Date: 2006-07-09T23:09:37+09:00 Subject: Re: Sorting arrays ------=_Part_128935_28794983.1152454173175 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/9/06, dblack@wobblini.net wrote: > > There's no issue of nil being smaller or larger than anything. The > first time through your loop, lowest is nil -- which means that the > item < lowest comparison is never evaluated. Okay, I sort of see that. The next time through, > lowest is "five", so item < lowest is evaluated. It's false, so the > next statement (lowest = item) is not executed. Don't get this looking at the 'if' statement if lowest == nil || item < lowest lowest = item First confusion is || , this I take to be 'or' ? Second, if the assignment of 'lowest = item' comes after the 'if' conditional, how does any 'tem become the lowest. The way I'm reading the statement (using the array - mylist = ['five', 'eight', 'one', 'ten', 'nine']) I interpret the second iteration as if lowest == nil or 'five' < lowest # lowest is still equal to nil ? Or could it be that in the 'if' block, the 'lowest = item' is set before the 'if conditons' are checked ? Stuart > ------=_Part_128935_28794983.1152454173175--