September 2007
Intermediate to advanced
600 pages
20h 21m
English
All the conditional processing used thus far has involved <cfif> statements. But as I stated at the beginning of this chapter, ColdFusion also supports another form of conditional processing: switch statements.
The best way to understand switch statements is to see them used. Listing 9.10 should be saved as file switch.cfm.
When you have executed Listing 9.10, you’ll notice that it does exactly what Listing 9.5 (file if5.cfm) does. The code here is very different, however.
<!--- Name: switch.cfm Author: Ben Forta (ben@forta.com) Description: Demonstrate use of <cfswitch> and <cfcase> Created: 07/01/2007 ---> <html> <head> <title>Switch</title> </head> <body> <!--- Get day of week ---> <cfset dow=DayOfWeek(Now())> ... |
Read now
Unlock full access