The scripts created in the last chapter flow only in a single direction—forward. That is, the same statements are executed in the same order every time a script is run. This does not allow for much flexibility, as any sort of dynamic programming will at the very least need to have a loop or two, not to mention the ability to check for the validity of certain conditions before proceeding onward.
You will now learn about the programming structures that enable your scripts to adapt to circumstances. In this chapter, you will learn
How to use the
if statement to execute code if a test expression evaluates to
How to execute alternative blocks of code when the test expression of an
if statement evaluates to ...