vendredi 28 décembre 2018

Does AND(&&) inside an If-Statement get checked in the order I type it?

Let's say I have this code:

if(number_a==1 && number_b==2) {
doStuff();
}

Will my code run any faster, If i split it up into:

if(number_a==1){
    if(number_b==2){
        doStuff();
    }

}

Or does the computer run the code in the exact order I gave it, checking a first, and instantly moving on if a isn't 1 ? Or is there a chance the computer checks b first, or checks both(even if a isn't 1)?

Aucun commentaire:

Enregistrer un commentaire