O'Reilly logo

Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started by Charlie Arehart, Raymond Camden, Ben Forta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

If and Else

The code in Listing 9.2 is logically correct: If it is Sunday or Saturday, then it is indeed the weekend, and the weekend message is displayed. But what if it is not Sunday or Saturday? Right now, nothing is displayed at all; so let’s fix that.

Listing 9.3 contains the revised code, capable of displaying a non-weekend message if necessary (see Figure 9.2). Save this code as if3.cfm, and then execute it.

Figure 9.2. <cfelse> enables the creation of code to be executed when a <cfif> test fails.
Listing 9.3. if3.cfm
<!--- Name: if3.cfm Author: Ben Forta (ben@forta.com) Description: Demonstrate use of <cfif> and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required