2.2. Procedural elements

A filled element typically contains:

  • “conditional” elements like if, else, and elseif,

  • non-conditional flow control elements like goto and submit,

  • procedural elements like script, log, disconnect, and exit.

2.2.1. The if, else, elseif element types

VoiceXML allows for conditional logic through the if, else, and elseif element types. Unlike if elements, the else and elseif elements are always empty - in other words, they do not contain any sub-elements, making the language somewhat idiosyncratic.

We can add conditional logic to the the Jimmy's Pizza example (see 2.1, “Forms,” on page 25), as shown in Example 2-12. We will test for three different conditions: a dissatisfied customer, a satisfied customer, and a moderately ...

Get Definitive VoiceXML™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.