From: Louise Rains Date: 2010-08-12T07:23:08+09:00 Subject: Re: syntax error, unexpected '}', expecting kEND Brian Candler wrote: >> q.inject(Array.new(4,0)){ |h,e| if e < 10000 then h[Math.log10(e).to_i] >> +=1 } > > "if" needs a matching "end", unless you use the postfix form: > > h[...] += 1 if e < 10000 > > BTW, even if you're using ruby 1.8.7, running ruby 1.9.x on your code > with the -w flag can sometimes give better error messages. Thanks, that is just the ticket! -- Posted via http://www.ruby-forum.com/.