<else>

Conditional logic used in <if>. Indicates code to be executed only when the conditions for the <if> element and all <elseif> elements within the <if> element are not met (that is, their cond attributes evaluate to false).

Each <if> element can contain only one <else> statement, but several <elseif> statements. However, an <else> is not required.

See also <if> and <elseif>.

Attributes

None.

Children

None.

Parents

Sample code

<vxml>
    <form>
    <field name="grammar_or_dtmf">
        <prompt>Press or say a number between 1 and 3.</prompt>
        <grammar> [one two three] </grammar>
        <dtmf> [dtmf-1 dtmf-2 dtmf-3] </dtmf>
        <filled>
            <if cond="grammar_or_dtmf == 'one'">
                <prompt>you said one</prompt>
            <elseif cond="grammar_or_dtmf == 'two'"/>
                <prompt>you said two</prompt>
            <elseif cond="grammar_or_dtmf == 'three'"/>
                <prompt>you said three</prompt>
            <else/>
                <prompt>you pressed <value expr=
                "grammar_or_dtmf.charAt(5)"/></prompt>
            </if>
        </filled>
    </field>
    </form>
</vxml>

For an example, see the VoiceXML sample application, Blackjack.vxml in the $NVP_HOME/appservice/applications/webapps/BlackJack directory. See Blackjack.