mardi 7 juin 2016

Term for when you stop code execution early on with an if?

What's the term for when you stop code flow early on with some sort of if statement and a return value?

E.g.:

bool myFunc(){
    if(userNotAllowed){ // <- What is this called?
        return false; // I've heard it given a name before.
    }
    //do lots of stuff
    //etc etc
    return true;
}

It's a sort of simple design pattern of sorts... An example would be look-before-you-leap or it's "Easier to Ask Forgiveness than Permission". But I don't think it has a silly name like that.

Aucun commentaire:

Enregistrer un commentaire