CASE program instruction All the VALUE steps are scanned until the first one is found that has the same value. The group of instructions following that VALUE step is executed. Execution continues at the first instruction after the END step. If no VALUE step is found that contains the same value as that in the CASE instruction, and there is an ANY step in the structure, then the group of instructions following the ANY step will be executed. If no VALUE match is found in the structure, and there is no ANY step, none of the instructions in the entire CASE structure are executed. Examples The following example shows the basic function of a CASE statement: CASE number OF VALUE 1:
TYPE "one" VALUE 2: TYPE "two" ANY TYPE "Not one or two" END The following sample program asks you to enter a test value. If the value is negative, the program exits after displaying a message. Otherwise, a CASE structure is used to classify the input value as a member of one of three groups. The groups are (1) even integers from zero to ten, (2) odd integers from one to nine, and (3) all other positive numbers. PROMPT "Enter a value from 1 to 10: ", x CASE x OF VALUE 0, 2, 4, 6, 8, 10: TYPE "The number", x, " is EVEN" VALUE 1, 3, 5, 7, 9:
TYPE "The number", x, " is ODD" ANY TYPE x, " is not an integer from 0 to 10" END The following example shows a special use of the CASE structure to test Boolean conditions: PROMPT "Enter a number", x CASE TRUE OF VALUE (x > 0): TYPE "The number was greater than 0." VALUE (x == 0): TYPE "The number was equal to 0." VALUE (x 0): TYPE "The number was less than 0." eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 119