<if>
<if>
The <if>
element is used for conditional logic. It has optional <else>
and <elseif>
elements.
Attributes
Name | Data type | Description |
---|---|---|
cond | String | An ECMAScript expression to evaluate. |
Notes
Note that the <else>
and <elseif>
tags both must contain a trailing forward slash to terminate.
Example
The output of the above script would be:
Computer: Say the magic number between one and nine. Human: Three. Computer: Try again. Say the magic number between one and nine. Human: Six. Computer: You're close. Try again. Say the magic number between one and nine. Human: Five. Computer: You guessed correctly!
Child Tags
<audio>, <assign>, <clear>, <data>, <disconnect>, <else>, <elseif>, <enumerate>, <exit>, <foreach>, <goto>, <if>, <log>, <prompt>, <reprompt>, <return>, <script>, <submit>, <throw>, <value>, <var>
Parent Tags
<block>, <catch>, <error>, <filled>, <foreach>, <help>, <if>, <noinput>, <nomatch>
Last updated