Line Breaks Are Significant

You must place the opening block delimiter on the same line as the method with which it is associated.

For example, these are okay:

3.times do |i|
    puts( i )
end

3.times { |i|
    puts( i )
}

But these contain syntax errors:

3.times
do |i|
    puts( i )
end

3.times
{ |i|
    puts( i )
}

Get The Book of Ruby now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.