Parker HannifinProgram FlowCode is executed sequentially, following the order in which it iswritten. But based on some input, you can shift code executionelsewhere in a program using conditional statements. Usingconditional statements, you can create code that tests for specificconditions and repeats code statements.The conditional statement provides a logical test—a truthstatement—allowing decisions based on whether the conditions aremet. In the code, you create an expression and test whether theresult is true.You can divide conditional statements into two sub-categories,selection and repetition.NOTE: Each level (or nest) uses 4 bytes of memory. For more onmemory use, see How Much Memory?SelectionThe selection structure controls the direction of program flow. Thinkof it as a branch in your program. When the conditions are met, theprogram moves to a different block of code. AcroBASIC providesthe following conditional statements:• IF/THEN• IF/ELSE/ENDIF• GOSUB• GOTOIF/THENPrograms need to run code based on specific conditions. TheIF/THEN statement lets a program test for a specific condition andrespond accordingly.The IF portion sets of the condition to test; if the condition provestrue, the THEN portion of the statement executes. If instead thecondition proves false, the THEN statement is ignored and programexecution moves on to the next statement.NOTE: Enclose the condition being tested in parentheses.Though the IF/THEN statement provides a single-line test, it canexecute multiple statements when the condition proves true. All thestatements must appear on a single line and be separated by aspace, colon, and another space.Programming Basics 19