vendredi 17 février 2017

Should I put my return inside of an else or at the end of the method?

Should I put my return inside of an else or at the end of the method?

private Boolean checkSomething(Object thing){

    if(condition){
        return true;
    } else {
        return false;
    }
}

OR

private Boolean checkSomething(Object thing){

    if(condition){
        return true;
    }
    return false;
}

Aucun commentaire:

Enregistrer un commentaire