if...then...else statement (SDL script)
An if...then...else statement provides a mechanism for conditional execution of statements in SDL script.
If...then...else statements can be nested.
An if...then...else statement uses the following keywords:
%if - starts the if...then...else statement and specifies the condition to be evaluated. For information about working with variables, item properties, item lists and operators, see the following topics:
%then - specifies a set of statements to run if the condition is satisfied.
%else - optional keyword that specifies a set of statements to run if the condition is not satisfied.
%endif - ends the if...then...else statement.
Syntax
%if <condition> %then
<set of statements for when condition is satisfied>
[%else
<set of statements for when condition is not satisfied>]
%endif
In this example the value of the Return Type property is evaluated. If the value of the Return Type property is void, 'return;' is generated, if the value is not void, 'return ReturnValue;' is generated.
%if %custom "Return Type" == "void" %then
"return;"
%else
"return ReturnValue;"
%endif
Was this helpful?