There is a important difference between the two block syntaxes in Ruby: Their precedence. Consider following code:
You would expect both method calls to produce the same result, wouldn’t you? Output:
method1 got a block
method2 got a block
Obviously the do-end block is passed to the first method in the expression while the {} block is passed to the method called directly before it. Another example shows that the assignment does not count as a method call here: