![]() | ![]() | Programming Guide |
Conditionally executes one or more JPL statements
iflogicalExprstatementBlock[else iflogicalExpr
statementBlock]
...
[elsestatementBlock]
logicalExpr- Specifies the condition under which JPL executes
statementBlock, wherelogicalExprcan be any logical expression. For more information on logical expression construction, refer to "Logical Expressions" in Application Development Guide.statementBlock- One or more statements that JPL executes if the preceding
logicalExprevaluates to true. IfstatementBlockhas more than one statement, enclose the block with open and close blocking characters {0} on the lines before and after.else iflogicalExpr- Optionally specifies the statement block to execute if all previous if and else if conditions evaluate to false and
logicalExprevaluates to true.else- Optionally specifies the statement block to execute if all previous if and else if conditions evaluate to false. Each else must be paired with an if statement and follow all else if statements associated with that if.
The
ifcommand specifies conditional execution of other JPL statements. Eachifcan be followed by one or moreelseifcommands to create a chain of conditional processing. JPL executes eachifandelse ifin the chain until it evaluates one of the conditions to true; JPL then executes the statement block and exits the chain. If all conditions in anifchain evaluate to false and the chain ends with anelsecommand, JPL executes theelsestatement block. If theifchain omits anelsecommand, JPL simply exits the chain and continues module execution.
//Determine a person's sex, based on personal title.
if title == 'MR'
sex = 'Male'else if title == 'MS'
sex = 'Female'else if title == 'MRS'
sex = 'Female'else if title == 'MISS'
sex = 'Female'else
{
sex = 'Unknown'
msg err_reset 'Please supply a title.'
}
![]()
![]()
![]()
![]()