? The first example seems to be favoured in “Well Grounded Rubyist” but
I discovered I could call each directly on the File.open object as it’s
enumerable. Any advantages of one over the other?
enumerable. Any advantages of one over the other?
Yes, you should always use the first form because that ensures the
file handle is closed properly - even in case of exceptions in the
block.