If-then-else-endif statements are used in design scripts to determine if an element has certain attributes and to control program flow based on the results. The following are example syntaxes:
if (expression) then 1 or more statements endif
if (expression) then 1 or more statements else 1 or more statements endif
if(expression) then 1 or more statements else if (expression) then 1 or more statements else if ... else 1 or more statements endif
The expression portion of an if statement must evaluate to an integer and is typically true or false. Any nonzero value is considered true. If the expression evaluates to false, or zero, the else portion of the statement, if present, is executed. The following design script segment makes use of the if-then-else-endif construct.
if (level == 23) then style = (1, 0.5) color = "green" else if (level == 45) then style = (1.0, 0.25, 0.5, 0.25) then area_fill = true color = "blue, sky" else style = 0 color = (0, 0, 0) endif