mercredi 18 février 2015

Recommendations about placement of logical operators in multiline condition expressions


Vote count:

0




This is really a detailed formatting question, but I stumble over it every time...


For multiline condition expressions what placement of the logical operators is preferred?




Alternative 1: logical operators at the end of each line



if (value1 == comparision1 &&
value2 != comparision2 &&
!comparision3.Contains(value3))
{
// stuff
}


Pro: lines are beautifully aligned


Con: logical operators are missed easily




Alternative 2: logical operators at the beginning of each line



if (value1 == comparision1
&& value2 != comparision2
&& !comparision3.Contains(value3))
{
// stuff
}


Pro: logical operators are strongly present


Con: alignment looks weird




What do you prefer? What formatting did helped you in the past? What formatting did confused you in the past?



asked 1 min ago







Recommendations about placement of logical operators in multiline condition expressions

Aucun commentaire:

Enregistrer un commentaire