Cfdefaultcase - MACROMEDIA COLDFUSION MX 61-CFML Reference

Cfml reference
Hide thumbs Also See for COLDFUSION MX 61-CFML:
Table of Contents

Advertisement

cfdefaultcase

Description
Used only inside the
in the
cfswitch
Category
Flow-control tags
Syntax
<cfdefaultcase>
See also
cfcase,
cfswitch
History
ColdFusion MX: Changed placement requirements: this tag does not have to follow all
tags in the
cfswitch
Usage
The contents of the
tag does not match any of the values specified by the
cfswitch
body. The contents of the
tags, functions, variables, and expressions.
You can specify only one
cfdefaultcase
item, but it is good programming practice to put it last.
Example
<!--- The following example displays a grade based on a 1-10 score.
Several of the cfcase tags match more than one score.
For simplicity, the example sets the score to 7 --->
<cfset score="7">
<cfswitch expression="#score#">
<cfcase value="10">
<cfset grade="A">
</cfcase>
<cfcase value="9;8" delimiters=";">
<cfset grade="B">
</cfcase>
<cfcase value="7;6" delimiters=";">
<cfset grade="C">
</cfcase>
<cfcase value="5;4;" delimiters=";">
<cfset grade="D">
</cfcase>
<cfdefaultcase>
<cfset grade="F">
</cfdefaultcase>
</cfswitch>
<cfoutput>
Your grade is #grade#
</cfoutput>
94
Chapter 2: ColdFusion Tags
tag body. Contains code to execute when the expression specified
cfswitch
tag does not match a of the value specified by a
tag body.
tag body is executes if the
cfdefaultcase
cfdefaultcase
cfdefaultcase
tag at any position within a
expression
cfcase
tag body can include HTML and text, and CFML
tag within a
cfswitch
statement; it is not required to be the last
cfswitch
tag.
cfcase
attribute of the
tags in the
cfswitch
tag. You can put the
cfcase
tag

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents