Previous
If Condition 
Next
For Loop 
ABC of JavaScript : An Interactive JavaScript Tutorial
Switch Case

Switch Case

Syntax:
switch (VARIABLE) {
case CONDITION : STATEMENT
break
case CONDITION : STATEMENT
break
case CONDITION : STATEMENT
break
default : STATEMENT
}

This has a similar function as the If condition - but it is more useful in situations when there is many possible values for the variable. Switch will evaluate one of several statements, depending on the value of a given variable. If no given value matches the variable, the default statement is executed.

Previous
If Condition 
Next
For Loop 

Comments

Comment


Comment




Comment Formating : HTML tags a, strong, em, b, i, code, pre, p and br allowed. Other tags will be shown as code(< will become &lt;). Urls, Line breaks will be auto-formated.