beautypg.com

20 - advanced command files, How to use the if command, 20 – advanced command files – Gasboy CFN III Manager Manual V3.6 User Manual

Page 213: How to use the if command -1, Advanced command files

background image

MDE-4871 CFN III Manager’s Manual for Windows® XP Embedded - Version 3.6 · August 2010

Page 20-1

How to Use the IF Command

Advanced Command Files

20 – Advanced Command Files

If you have had some computer programming experience, this chapter must be

self-explanatory. If you have not had any computer programming experience, you might want
to discuss this chapter with the person in your organization who has the most knowledge about
computers.

How to Use the IF Command

The IF command allows conditional execution of the next one or more commands in a
command file. IF uses several switches that allow you to specify conditions.

IF supports block-structured statements, and uses Pascal-type blocking. The format of an IF
statement is:

IF condition [text]

BEGIN
command1
command2
command3
. . . .
END

ELSE

BEGIN
command1
command2
command3
. . . .

END

If condition is true, the commands following IF will be executed. If condition is not true, the
commands following the optional ELSE will be executed. The ELSE part is optional and may
be omitted if not required.

BEGIN and END, on lines by themselves, delimit the commands. They are not required if only
one command line follows IF or ELSE.

IF statements can be nested.
Note: The indents are not required. Blank lines and tabs and spaces at the beginning of lines

are ignored (but is a good way to keep track of subsections in your code).

This manual is related to the following products: