CFSWITCH/CFCASE/CFDEFAULTCASE

Used with CFCASE and CFDEFAULTCASE, the CFSWITCH tag evaluates a passed expression and passes control to the CFCASE tag that matches the expression result. You can optionally code a CFDEFAULTCASE tag, which receives control if there is no matching CFCASE tag value.

Syntax

<CFSWITCH EXPRESSION="expression">
    <CFCASE VALUE="value" DELIMITERS="delimiters">
     HTML and CFML tags
    </CFCASE>
    additional <CFCASE></CFCASE> tags
    <CFDEFAULTCASE>
     HTML and CFML tags
    </CFDEFAULTCASE>
</CFSWITCH>
EXPRESSION

Required. Any ColdFusion expression that yields a scalar value. ColdFusion converts integers, real numbers, Booleans, and dates to numeric values. For example, TRUE, 1, and 1.0 are all equal.

VALUE

Required. One or more constant ...

Get Sams Teach Yourself ColdFusion® in 21 Days 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.