Multi Line Conditioning VS Single Line Conditioning!

 

Dear Experts,


Could you please advise which one of the following conditioning method is the best and most effecting in codding?

Thanking you in advance!

if(Condition1)
  {
if(Condition2)
  {
if(Condition3)
  {
     Take Action.
    }
  }
}

Or

if(Condition1 && Condition2 && Condition3)
  {
     Take Action.
}
 

Whatever does the job for you.

But i prefer the first one because its easier to comment out // specific statements.

 
Marco vd Heijden:

Whatever does the job for you.

But i prefer the first one because its easier to comment out // specific statements.

My Doubt is Clear Now!

Thank You!

 
If condition1 is false the others are not computed — both are equivalent — just as easy to comment out.
if(Condition1 /*&& Condition2*/ && Condition3)
  {
     Take Action.
  }
if(Condition1 && 
// Condition2 && 
   Condition3
){
     Take Action.
  }
 
William Roeder:
If condition1 is false the others are not computed — both are equivalent — just as easy to comment out.

That was very very helpful to understand more clearly.

Thank you so much!

Reason: