represents an element of a template object that inserts tclause if the condition evaluates to True.


inserts fclause if the condition does not evaluate to True.

Details and Options

  • condition can be either a TemplateSlot or TemplateExpression.
  • The tclause is used when condition===True.
  • If an fclause is not provided, the value Sequence[] is used instead.
  • In an XML template, TemplateIf can be indicated using <wolfram:condition>...</wolfram:condition>. Multiple conditions can be nested using <wolfram:switch><wolfram:condition>...</wolfram:condition>...<wolfram:else>...</wolfram:else></wolfram:switch>.
  • TemplateIf has the option InsertionFunction, with default setting Inherited, which specifies how the content of each template slot should be formatted before inserting it.


open allclose all

Basic Examples  (1)

Using TemplateIf:

Run a test over a TemplateSlot:

Options  (1)

InsertionFunction  (1)

Using an InsertionFunction:

InsertionFunction can be any function:

Introduced in 2014