3.1 assign
Element type |
assign |
Attributes |
expr | name |
Parents |
block | catch | error | filled | help | if | noinput | nomatch |
Children |
None. |
Description |
Assigns a value to a variable. The variable must have already been declared with a var element or with ECMAScript code, or else this will cause a semantic.error to be thrown. |
DTD
<!ELEMENT assign EMPTY > <!ATTLIST assign name %field.name; #REQUIRED expr %expression; #REQUIRED >
Language model
Attributes
The two attributes of assign represent a key/value pair.
-
name : field.name
-
Indicates the name of the ECMAScript variable to be altered.
-
expr : expression
-
An ECMAScript expression whose value will be assigned to the variable.
Children
None.
Examples
Example 3-1 Using assign to increment volume
<?xml version="1.0" encoding="iso-8859-1"?> <vxml version="1.0"> <var name="volume" value="1"/> <form id="test"> <block> <if cond="volume > 5"> <assign name="volume" expr="volume - 1"/> </if> <if cond="volume < 5"> <assign name="volume" expr="volume + 1"/> </if> </block> </form> </vxml>