You need to understand that the code block (wrapped by either {
… }
or do
… end
,) is itself an object, that is an argument to the add_item()
method, so must be part of the same statement.
See this list: Ruby Learning Resources [WikiLists]
You need to learn basic Ruby before learning how the SketchUp API extends Ruby to make plugins.