Confirming a User's Choice
While it's useful to give information to a user, sometimes you'll want to also get information back in return. Script 2.7 shows how to find out if the user accepts or rejects your question. This script also introduces the idea of conditionals, which is where the script poses a test and performs different actions depending on the results of the test.
Script 2.7. You can alter a reply, depending on how the user reacts to a prompt.
More about conditionals
Conditionals break down into three parts: the if section where we do our test; the then section, where we put the part of the script we want to do if the result is true; and an optional else section, which contains the part of the script we want to have happen if the result of the test is not true. The contents of what we're testing in the if section are in parentheses, and the contents of the other two sections are each contained in braces.
To confirm a choice: