if command (C and C++)
The if
command lets you conditionally perform
a command. You can optionally specify an else
clause
on the if
command. If the test expression evaluates
to false and an else
clause exists, the command associated
with the else
clause is performed. The if
and else
keywords
must be lowercase and cannot be abbreviated.
expression
- A valid z/OS® Debugger C and C++ expression.
command
- A valid z/OS Debugger command.
When if
commands are nested and else
clauses
are present, a given else
is associated with the
closest preceding if
clause within the same block.
Usage notes
- An
else
clause should always be included if theif
clause causes z/OS Debugger to get more input (for example, anif
containingUSE
or other commands that cause z/OS Debugger to be restarted because anAT
-condition occurs). - The
if
command cannot be used while you replay recorded statements by using thePLAYBACK
commands by using thePLAYBACK
command.
Examples
- The following example causes
grade
to receive the value"A"
if the value ofscore
is greater than or equal to 90.if (score >= 90) grade = "A";
- The following example shows a nested
if
command.if (paygrade == 7) { if (level >= 0 && level <= 8) salary *= 1.05; else salary *= 1.04; } else salary *= 1.06;