Arbortext Command Language > Using the Arbortext Command Language > Using Conditional Logic
  
Using Conditional Logic
The Command Language has four commands available to conditionalize execution of commands to a specific condition. These commands are if, while, for, and switch.
The if, while, for, and switch commands do not change the $status variable (a predefined Arbortext Editor variable), unless a syntax error results during evaluation of the logical expression describing the conditions in which the commands are to be executed (expr in the syntax statement above). In this case, $status is set to 2 and the statement is aborted.
If you are typing an if, while, for, and switch command at the command line, the entire command must appear on one line. However, if the command is read from a command file, the block of commands may extend across multiple lines. Line breaks can occur at command boundaries or, for a conditional command like if, while, for, and switch at the start of the command block, that is, before or after the left brace ({). If you need to break the line in the middle of a command, put a backslash at the end of the line preceding the break.
Related Topics
Break and continue
Using looping and conditionals