Conditional Branching Instructions 32 . 33 ; If I/O signal 1033 is on and Boolean "need_part" is 34 ; true, then pick up the part 35 ; else alert the operator. 36 37 IF SIG(1033) AND need_part THEN 38 MOVE loc1 39 CLOSEI 40 DEPART 50 41 ELSE 42 TYPE "Part not picked up." 43 END 44 . CASE value OF The IF...THEN...ELSE structure allows a program to take one of two different actions. The CASE structure will allow a program to take one of many different actions based on the value of a variable. The variable used must be a real or an integer. The form of the CASE structure is: CASE target OF VALUE list_of_values: code block (executed when target is in list_of_values ) VALUE list_of_values:
code block (executed when target is in list_of_values ) ... ANY code block (executed when target not in any list_of_values) END real value to match. list_of_values list (separated by commas) of real values. If one of the values in the list equals target, the code following that value statement is executed. Example 5 ; Create a menu structure using a CASE statement 66 67 50 TYPE "1. Execute the program." 68 TYPE "2. Execute the programmer." 69 TYPE "3. Execute the computer." 70 PROMPT "Enter menu selection.", select 71 72 CASE select OF 73 VALUE 1: 74 CALL exec_program() 75 VALUE 2: 76 CALL exec_programmer() 77 VALUE 3:
78 CALL exec_computer() 79 ANY eV+Language User's Guide, v2.x, 18318-000 Rev A Page 70