JS.10.3 The 'if' Statement

The if conditional structure executes the statements within the 'if' block only when the specified condition is true. Alternative conditions can be tested by using one or more optional 'else if' blocks. An optional final 'else' block will be executed if all other conditions evaluate false.

if(condition0) {

  statements to execute if condition0 is true

}

else if(condition1) {

  statements to execute if condition1 is true

}

else if(condition2) {

  statements to execute if condition2 is true

}

else if(condition3) {

  statements to execute if condition3 is true

}

else {

  statements to execute if all above conditions are false

}

See Also

Appendix JS.10.6, The 'switch' Statement, to conveniently test a larger set of conditions.

<< JS.10.2 Function Definition © 1996-2013 InetSoft Technology Corporation (v11.5) JS.10.4 The 'try-catch' Statement >>