From: Jacob Fugal Date: 2005-09-03T08:10:10+09:00 Subject: Re: Idiomatic conversion of yielding block to array On 9/2/05, Simon Kr�ger wrote: > s1 = ['this', 'is', 'a', 'test'].join("\n") > s2 = ['this', 'is', 'the', 'test'].join("\n") > > (0...s1.size).inject(1) do |l, i| > puts "difference on line: #{l}" or break if s1[i] != s2[i] > l = (s1[i] == 10) ? l+1 : l > end What's the second to last line for? l = (s1[i] == 10) ? l+1 : l That will always return false (since s1[i] is always a string, and string/integer comparison is always false), so your line count will always be 1. Jacob Fugal