mardi 10 août 2021

Use 2 ifs or if else if to check for 2 possible condition

Which of the following is preferable when checking 2 possible outcome to condition?

if (x == 2) {

}
else if (x != 2){

}
//or
if (x == 2) {

}
if (x != 2){

}

Aucun commentaire:

Enregistrer un commentaire