Open main menu

CDOT Wiki β

Changes

Team !YOU - OOP344

418 bytes added, 13:25, 25 January 2010
m
Discussion: Nesting
|-
| fmDeOliveira || I usually put two spaces for a new indent, and keep a blank line between new big blocks of code and whatever comes before it (usually an if statement, a for loop, or the signature of a function).
|-
|}
 
 
=== (Discussion: Nesting) ===
How do we deal with else statements?
 
Option 1: else right after the end of the if block
if (a > 0) {
printf(".");
} else {
printf(",");
}
 
Option 2: else on a line below the end of the if block
if (a > 0) {
printf(".");
}
else {
printf(",");
}
 
{| class="wikitable" border="1"
|+ Discussion
! Name !! Comment
|-
| fmDeOliveira || I prefer option 2.
|-
|}