Search code examples
rubyreserved-words

Does reserved word 'then' can always be replaced with semicolon or linebreak?


Does using then instead of semicolon or linebreak have only decorative purpose (to make code more readable)?


Solution

  • The keyword then can appear in two places in ruby: if statements and case statements. In both cases it can be replaced with a linebreak or a semicolon.

    So yes, it's merely decorative.