If Statement |
Syntax | cam IF <condition> <statements/blocks> { ELSE IF <condition> <statements/blocks> } [ELSE /> <statements/blocks>] END [IF] |
Example | cam IF %scale > 4000 render [all],!black ELSE IF %scale > 1000 render [all],!blue END IF |
If statements are used to control which parts of the Chameleon script are executed. They can be used anywhere in the script to control assignment of variables and rendering of features. Conditions are either a single floating point value (where zero equals false, and any other value is true) or a conditional expression.
Conditional expressions have the following syntax:
[NOT] float [ < | > | <= | >= | == | != ] float
There is also a special range operator:
float1 <= float2 < float3
This will evaluate to true if float2 is greater than or equal to float1, and less than float3. Any of the floats in a conditional can be either literals or constant values.