Looping and Decision Making The following programming examples illustrate how to code loops and decision-making program structures. Example 1 The following examples illustrate the similarities and differences between the SELECT CASE and IF...THEN...ELSE statements. Here is an example of using block IF...THEN...ELSE for a multiple-choice decision: INPUT X IF X = 1 THEN PRINT "one" ELSEIF X = 2 THEN PRINT "two" ELSEIF X = 3 THEN PRINT "three" ELSE PRINT "must be integer from 1-3" END IF The above decision is rewritten using SELECT CASE below: INPUT X SELECT CASE X CASE 1 PRINT "one" CASE 2 PRINT "two" CASE 3 PRINT "three" CASE ELSE PRINT "must be integer from 1-3" END SELECT The following decision can be made with either SELECT CASE or the block IF...THEN...ELSE statement. The comparison is more efficient with the block IF...THEN...ELSE statement because different expressions are being evaluated in the IF and ELSEIF clauses. INPUT X, Y IF X = 0 AND Y = 0 THEN PRINT "both zero." ELSEIF X = 0 THEN PRINT "only X is zero." ELSEIF Y = 0 THEN PRINT "only Y is zero." ELSE PRINT "neither is zero." END IF