From: g_f <8si.greg@...> Date: 2009-08-18T09:13:03+09:00 Subject: Re: while !file.eof? On Aug 17, 8:39 am, Derek Smith wrote: > But now, what is the diff between > > File.open( "maillog" ).each do |line| > and > File.open("mailog").each { |line| > > one better, or more ruby standard?  I did not see a diff. > Personally I like "without the do" as there is less to type. Ah. "do ... end" vs. "{ ... }". Yes, that was a bit confusing at first. They're basically the same - they signify a block being passed into the method. The curly-brace "{ ... }" block is generally used when you're using a single-line of code and "do ... end" is generally a multi-line block. Also, I always use "{ ... }" for map/collect or select/reject methods even if they're taking multiple lines, but that's because I wrote in Perl for ages and that's how it did it. I find that the curly-braces stand out more and for skanky code I want to make it easy to see where the block starts and ends. "do" and "end" tend to blend into the rest of the code making it "prettier" because it's all text and not looking like line-noise. Greg