# <elseif>

Description

The `<elseif>` element is used within the conditional logic statement `<if>` and with the optional `<else>` element. It is used to define content to be executed in a specific condition and is only interpreted if the conditions specified by the `<if>` element and any previous `<elseif>` elements are not satisfied.

Syntax

    <elseif
        cond="ECMAScript_Expression"/>

Attributes

Attribute | Description
cond | An ECMAScript expression to be evaluated and used as a boolean value for this conditional logic statement. Required.

Parents

<if>

Children

None.

Extensions

None.

Limitations/Restrictions

None.

Example

    <?xml version="1.0"?>
    <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
      <form>
        <var name="number_var" expr="5"/>
        <var name="boolean_var" expr="true"/>
        <var name="string_var" expr="'hello'"/>
        <block>
          <if cond="number_var != 5">
            The number is not five.
          <elseif cond="!boolean_var"/>
            The boolean is not true.
          <elseif cond="string_var != 'hello'"/>
            The string is not hello.
          <else/>
            The number is five and
            the boolean is true and
            the string is hello.
          </if>
        </block>
      </form>
    </vxml>