Developer

<<case>>

The <<case...>> function provides the switch-case logic to the SDML. It takes a required switch argument and at least one case-expression argument pair. It may take as many additional case-expression pairs as are needed, plus an optional default argument.

During expansion, this function tag compares the value of the switch argument to each provided case argument in turn. It will return the expression argument for the first case argument to which the switch argument matches.
As an optional argument, a default value may be provided that will be returned by the function when the switch argument does not match any provided case argument. The syntax for the default return value is default=returnValue, where default is a keyword. For this reason, neither the value of the switch argument, nor any of the case arguments may be the value default.

Arguments

    <<case switch case1=exprssion1 [caseN=expressionN] [default=defaultExpression]>>
  • switch The value the function will switch on, comparing to the value of each case argument until a match is found.
  • case1 The first case argument to the function. This is a required argument and must be immediately followed by an equal sign (=) with no whitespace between the case argument and the sign. The expression1 argument immediately follows the equal sign, also with no whitespace allowed.
  • expression1 The first expression argument to the function. This is a required argument and contains the value the function will return when switch matches case1. case1 and expression1 are separated by an equal sign with no whitespace allowed between then, as in: case1=expression1. Any SDML text in expression1 will be expanded after it has been returned by the function.
  • caseN Additional optional case arguments to the function. If case1 does not match switch, the function will compare each subsequent case argument in order until a match is found. Each caseN argument must be followed by and equal sign and then a corresponding expressionN value. No whitespace can exist between each case-expression pair.
  • expressionN Additional optional expression arguments to the function. Each case argument must be followed by a corresponding expressionN value. Each case-expression argument pair must be separated by an equal sign with no white space allowed between then, as in: caseN=expressionN. Any SDML text in expressionN will be expanded after it has been returned by the function.
  • default=defaultExpression This optional argument specifies the expression returned by the function should the switch not match any of the case values. The syntax for this argument requires the text default= followed by the default expression the function should return.

Parameters

None