javascript - how to control if /else if / else

Posted by Fernando SBS on Stack Overflow See other posts from Stack Overflow or by Fernando SBS
Published on 2010-05-25T14:45:05Z Indexed on 2010/05/25 14:51 UTC
Read the original article Hit count: 192

How to control to which if the else is correlated?

ex:

if X = 1 { // A
   if Y > 1 { // B
      gothere();
   }
}
else if X < 1 { // C
    gohere();
}
else { // D
   gonowhere();
}

how to make sure C and D will not be related to B???

here´s another example:

if xxx {

    ...

FM_log(7,"vList.length = "+vList.length);

if (skippingAvancado) 
   if (vList.length > 1)        
    changeVillage();
else {
   if (skipcounter >= maxSkipCount) {
       FM_log(7,"ROTINA ANTIGA SKIPCOUNTER");
       changeVillage();
   }
}
else {

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about if-else-statement