Enter age ? 16 child rate done
In detail what happens is:
IF
is tested: AGE > 16END IF
:
"done" is printed.There are several ways that the previous program could have been written. Here is another way:
PRINT "Enter age" INPUT AGE ' IF AGE <= 16 THEN PRINT "child rate" ' true branch ELSE PRINT "adult rate" ' false branch END IF ' END
The true branch of a two-way decision is executed with the
condition part of the IF
statement is true.
In this new version of the program, the condition
has been changed, so you must be careful about
which statements are in the true branch and in the false branch.
Check if the new version of the program works correctly: What happens if the user enters an age of 23?