Can anyone point me to an idiom for intentional switch fallthrough using cfswitch?
My desire is for something similar the following to output "αβ"; currently it does the 'sane' thing and implicitly breaks:
<cfswitch expression="α">
<cfcase value="α">
<cfoutput>α</cfoutput>
<!--- explicit fallthrough to next case here? --->
</cfcase>
<cfcase value="β">
<cfoutput>β</cfoutput>
<!--- explicit break here? --->
</cfcase>
<cfdefaultcase>
<cfoutput>γ</cfoutput>
</cfdefaultcase>
</cfswitch>
AFAIK, it can't be done with the tag based version. This line from the documentation seems to confirm CFCASE always performs a break:
"... You do not have to explicitly break out of the cfcase tag.."
However, the cfscript version doesn't. It behaves more like java's switch/case. After matching α
, it'll fall through to all subsequent cases, unless explicitly told to break
.
<cfscript>
switch("α") {
case "α":
WriteOutput("α");
case "β":
WriteOutput("β");
break; // explicit break
default:
WriteOutput("γ");
}
</cfscript>