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

Putting It All Together

<cfif> is one of the most frequently used tags in CFML. So before we move on to the next subject, let’s walk through one more example—a slightly more complex one.

Guess the Number is a simple game: I’m thinking of a number between 1 and 10; guess what number I am thinking of. ColdFusion selects a random number, you guess a number, and ColdFusion will tell you whether you guessed the correct one.

Listing 9.6 contains the code for guess1.cfm. Save it in the 9 directory, but don’t execute it from within Dreamweaver. Instead, use this URL to execute it:

http://localhost:8500/ows/9/guess1.cfm?guess=n

Replace n with a number from 1 to 10. For example, if you guess 5, use this URL:

http://localhost:8500/ows/9/guess1.cfm?guess=5 ...

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