[ESS] Formatting if else blocks
A.J. Rossini
blindglobe at gmail.com
Wed Oct 19 19:15:15 CEST 2005
I like the second version. Primarily, because it solves the decision
path for things like:
if ( ) {
} else if {
} else if {
}
which can get really confusing by the 5th indentation (it's not my
code that I've had this problem with, hence I've preferred:
if ( ) {
} else {
if ( ) {
} else {
if ( ) {
}
}
}
But perhaps it's just me.
On 10/19/05, Kevin Wright <kwright68 at gmail.com> wrote:
> Is there a recommended way to format if..else blocks? I used to write my
> code this way:
>
> if(cond){
> print()
> }
> else {
> print()
> }
>
> You can't cut and paste this to the command line, so I've started to use:
>
> if(cond){
> print()
> } else {
> print()
> }
>
> Sometimes I don't need/use braces on the 'else' block
> if(cond){
> print()
> } else
> print()
>
> In this latter case, ESS doesn't indent the second print statement. Would it
> make sense for ESS to indent the line after "} else" or should I change my
> coding style?
>
> Comments welcome.
>
> Kevin Wright
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>
--
best,
-tony
blindglobe at gmail.com
Muttenz, Switzerland.
"Commit early,commit often, and commit in a repository from which we can easily
roll-back your mistakes" (AJR, 4Jan05).
More information about the ESS-help
mailing list