Hopefully a simple question: I was just wondering if there was a convention for putting multiple statements inside an else, or using else-ifs. So, is it generally preferred to use an else statement with statements inside of it, like so:
if(r>0){
return x;
} else {
if(completed==false){
return y;
} else if(started==true){
return z;
} else{
return xx;
}}
or to use else ifs, like so:
if(r>0){
return x;
} else if(completed==false){
return y;
} else if(started==true){
return z;
}else{
return xx;
}}
Aucun commentaire:
Enregistrer un commentaire