<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
Parent Tags
Last updated