in reply to Re^5: How has your coding style changed over the years?
in thread How has your coding style changed over the years?
In my perception/style, that end (and done) should be indented
sh: for i in 1 2 42 ; do echo $i done csh/tcsh: foreach i (1 2 42) echo $i end
It is all about the visual understanding of the code-flow. You read the statements start (if/while/do/for/unless/…) en see the *block* will not be executed, and you need to navigate to the next statement (which of course has the same indent), The end is not the next statement, but the (visually uninteresting) end/close of the block belonging to the statement you just skipped. My brain doesn't want to see that end at all when browing code.
In your Ruby example do and end are syntax only. The represent no action whatsoever and act as { and }. All of them are no statements: they are syntax (to mark start and end of a block), just like ; is to mark the end of a statement.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: How has your coding style changed over the years?
by LanX (Saint) on Aug 11, 2022 at 13:53 UTC | |
Re^7: How has your coding style changed over the years?
by Fletch (Bishop) on Aug 11, 2022 at 14:01 UTC | |
by GrandFather (Saint) on Aug 12, 2022 at 03:53 UTC |