According to the specification section 9.2.3:
Conditions in statement position MUST accept only INT, STR, or TNS, with STR and TNS values interpreted according to the truthiness rules defined elsewhere in this specification. The interpreter MUST evaluate the IF branch first, then each ELSEIF in source order until one branch is taken, and finally the ELSE block when present and no earlier branch matched.
However, according to the specification section 3.3:
Conditions MUST accept values of any type. When evaluating a condition, the runtime MUST coerce the value to its boolean representation according to that type's conversion rules (see 4 for type-specific boolean semantics).
Section 3.3 is correct.
According to the specification section 9.2.3:
However, according to the specification section 3.3:
Section 3.3 is correct.