blob: 56019a6584ccd4f7af817a847959e28c95a623cb [file] [log] [blame]
40 columns |
>>> indentation
if(true){return 42;}else{return 13;}
<<<
if (true) {
return 42;
} else {
return 13;
}
>>> nested
if (true){
if (true){
if (true){
return true;
} else{
return false;
}
}
}else{
return false;
}
<<<
if (true) {
if (true) {
if (true) {
return true;
} else {
return false;
}
}
} else {
return false;
}
>>> single-expression then body
if(true)print("true!");
<<<
if (true) print("true!");
>>> block then body
if(true){print("true!");}
<<<
if (true) {
print("true!");
}
>>> single-expression else body
if(true)print(1);else print(0);
<<<
if (true)
print(1);
else
print(0);
>>> chained else if
if (0 == 0) {
zero = 0;
} else if (0 == 1) {
zero = 1;
} else if (0 == 2) {
zero = 2;
}
<<<
if (0 == 0) {
zero = 0;
} else if (0 == 1) {
zero = 1;
} else if (0 == 2) {
zero = 2;
}
>>> long if without curlies
if (condition) someLong(argument, another);
<<<
if (condition)
someLong(argument, another);
>>> long if else without curlies
if (condition)
someLong(argument, another);
else
anotherLong(argument, another);
<<<
if (condition)
someLong(argument, another);
else
anotherLong(argument, another);
>>> long if long else without curlies
if (condition)
someLong(argument, another);
else
anotherLong(argument, another, arg);
<<<
if (condition)
someLong(argument, another);
else
anotherLong(argument, another, arg);