But if the closing curly brace marks the end of the if part of an if else statement,
the else keyword has to be on the same line as the closing brace.
The code will not work if the else is on the next line AFAIK.


On Aug 28, 2009, at 6:11 PM, hadley wickham wrote:

An opening curly brace should never go on its own line and should always be followed by a new line; a closing curly brace should always go on its own line.

It seems to me that the opening an dosing curly brace should go on their own lines to allow the reader to immediately know what is encompassed in the curly brace:

In my view, that's the purpose of indenting - you see scope from
indenting.  Again, that's just my personal preference, and while I can
make my students follow it, I don't expect the rest of the world to
fall in line (although it would be nice ;)

Hadley

--
http://had.co.nz/

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to