Conditional Execution

The only time that a failure condition does not terminate execution is if it occurs in an if block.

Unlike most programming languages, Import does not evaluate an expression to determine whether a conditional should be executed. Rather, the code contained in the block following the if statement is executed like any other code, except that if it fails, this failure is interpreted as a false result. Thus, the statement if { find "BEGIN" } would be false if the string "BEGIN" did not exist in the data file. When a failure occurs in an if block, execution of that block halts and control passes back to the enclosing block. If the if block executes to normal completion, then the if test is considered by Import to be successful, and a true result is registered.

From this point on, any block preceded by a then or else is executed based on the condition returned by the if block (until such time as another if block is encountered). If the condition recorded is true, then blocks are executed. Otherwise, else blocks are.