Template:Sw/doc

This template is like the function, but preserves newlines and spaces from the start and end of the possible values (not from the values used in the conditions, if that is desired, put them all in quotes). A default value is required as second parameter:


 * " " gives "".
 * " " gives "".


 * " " gives "".
 * " " gives "".
 * " " gives "".


 * " " gives "".
 * " " gives "".
 * " " gives "".
 * " " gives "".


 * " " gives "".
 * " " gives "".
 * " " gives "".

The template can be easily extended to allow more parameters.

#switch
A call of  essentially takes an n × 2 array, with key values in the first column and result values in the second column, a default value, and a control value, and returns the result value corresponding to the first key value which is equal to the control value, if any, and otherwise the default value.

The call of  corresponds to a nesting of , so equality is defined in the same way as for  :


 * gives "".
 * gives "".
 * gives "".
 * gives "".
 * gives "".
 * gives "".

A switch can be used to store data. This is done in. However, retrieval gives a very high preprocessor node count of twice the number of cases until the match, so with a maximum of twice the total number of cases, which is twice the already high count for a template call with named parameters, see Help:Array.