vegetable = "";
switch(vegetable) {
case "carrot":
writeOutput("Carrots are orange.");
break;
default:
writeOutput("You don't have any vegetables!");
break;
}
Expected Result: You don't have any vegetables!
<cfset vegetable = "" />
<cfswitch expression="#vegetable#">
<cfcase value="carrot">
Carrots are orange.
</cfcase>
<cfdefaultcase>
You don't have any vegetables!
</cfdefaultcase>
</cfswitch>
Expected Result: You don't have any vegetables!
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.