Switch Statement

A switch statement chooses a branch to be executed based on a value. One or more values can be listed on each case. A 'break' must be included at the end of each case to terminate the switch statement.

switch(action) {

case 'A':

  text = 'Add';

  break;

case 'D':

  text = 'Default';

  break;

default:

  text = "N/A";

  break;

}

The default label at the end serves as a catch-all phrase. If the switch value does not match any of the listed values, the default section is processed.

<< While Loop © 1996-2013 InetSoft Technology Corporation (v11.5) Functions >>