WLJS LogoWLJS Notebook

TemplateIf

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

TemplateIf[condition, tclause, fclause] inserts fclause if the condition does not evaluate to True.

Examples

TemplateApply[
  StringTemplate["Hello, `name`! `TemplateIf[premium, \"Premium user.\"]"],
  <|"name" -> "Alice", "premium" -> True|>
]

Please visit the official Wolfram Language Reference for more details.

On this page