jeudi 2 décembre 2021

Is two ifs faster than a single if and?

I need to run multiple if statements as fast as I possibly can and I had this somewhat weird idea. Is it faster to have two consecutive if statements than it is to have one if and?

Here's my code in case you didn't understand my horrible explanation.

if a && b {
    //Do stuff
}

So would that be faster or would this be faster?

if a {
    if b {
        //Do stuff
    }
}

Aucun commentaire:

Enregistrer un commentaire