Log In | Not a Member? | Support | |
SYNTAX
If expression DESCRIPTION The If… control structure executes the list of commands following the first true (nonzero) expression. Note that null strings evaluate to zero. Although several expressions may be true, no more than one set of commands executes. Note that the command's structure allows you to specify any number of Else If clauses and does not require a final Else clause; however, the following rules apply: • Return characters (as shown on the syntax line above) or semicolons must appear at the end of each line. • The pipe specification (|), conditional command terminators (&& and ||), and any input and output specifications (<, >, >>, ≥, ≥≥, ∑, and ∑∑) must appear following the End statement. They apply to all of the commands in the list.
IMPORTANT INPUT None OUTPUT None STATUS
If… can return the following status codes:
PARAMETERS command1 [command2]… A list of one or more commands. expression A Boolean statement, MPW Shell variable, or string literal that can be evaluated to a 0 or nonzero value. OPTIONS None EXAMPLES The following If… control structure produces an audible indication of the success or failure of the command that came before it in the code.
If {Status} == 0 In this script, the If… control structure closes all the open windows except the active window and the Worksheet window.
For window in `Windows` Using the suffix of a file to determine whether it is written in C or C++, this script automatically compiles the file with the appropriate compiler.
If "{1}" =~ /≈.c/ If you save this script as a file named Compile, you can compile either a C or C++ file with the command Compile filename SEE ALSO
|