Let's say I have three conditions: Condition1, Condition2, Condition3. If all the conditions are fulfilled then the method/function returns true else false.
Technique one:
function check(){
if(Condition1 is true AND Condition2 is true AND Condition3 is true){
return true;
}
return false;
}
Technique two:
function check(){
if(Condition1 is false){
return false;
}
if(Condition2 is false){
return false;
}
if(Condition3 is false){
return false;
}
return true;
}
Which of the techniques would be better?