Skip to main content

if/else/elseif

Description

if/else/elseif — tags for simple conditions, outputting different responses depending on the conditions, transition to other states depending on the conditions.

tip
More complicated conditions can be set under the tag script.

Value type

  • string — valid js-expression that returns boolean

Parameters

  • none

Nested data

  • tags

How to use

  • Simple example of use:
if: condition()
a: Response 1
elseif: b == 3
a: Response 2
else:
a: Response 3
  • After if there should go js-expression with the boolean result.
theme:/
state: GoodBye
q!: * (so long|bye|see you) *
if: $session.name
a: So long, {{ $session.name }}!
else:
a: So long, human!
state:
q!: $Number
script: $temp.age = parseInt($parseTree.value);
if: $temp.age > 18
a: More than 18
elseif: $temp.age == 18
a: Exactly 18
else:
a: Less than 18