I know this questions has been touched on elsewhere, but I'm slightly confused about the proper syntax for multi-line (block?) if else
statements in ruby.
As an example:
if condition then
do something
do somethingelse
do yetanotherthing
done
else
do acompletelyunrelatedthing
done
I understand that the then
statement is required if multiple lines are used, but is the done
before the else
necessary? This seems like it would break out of the if...else
context. When I do include this done
I get:
syntax error, unexpected '\n', expecting tCOLON2 or '[' or '.'
When I don't include it I get:
syntax error, unexpected keyword_else, expecting keyword_end