Multi Line Conditioning VS Single Line Conditioning!

To add comments, please log in or register
dbmlbm
25
dbmlbm  

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.
}
Marco vd Heijden
Moderator
12529
Marco vd Heijden  

Whatever does the job for you.

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

dbmlbm
25
dbmlbm  
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!

William Roeder
20083
William Roeder  
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.
  }
dbmlbm
25
dbmlbm  
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!

To add comments, please log in or register