Documentation

switch

Syntax: %switch(expression,value,expression,value...)

Evaluates each expression until one is found that is true, and then returns the value given after the expression.

Examples:

a=10
#SHOW %switch(@a=1,"a is one",@a < 0,"a is negative",@a=10,"a is ten",@a >= 10,"a is ge ten")

displays "a is ten"

Note that you can implement an "else" clause at the end by using an expression of "1" or true. This will cause the final value to be returned if no other expressions matched.

Add comment

Login or register to post comments