<!---
Name:        guess4.cfm
Author:      Ben Forta (ben@forta.com)
Description: Demonstrate use of multiple if statements
Created:     3/27/01
--->

<HTML>
<HEAD>
   <TITLE>Guess the Number - 4</TITLE>
</HEAD>

<BODY>

<!--- Set range --->
<CFSET GuessLow=1>
<CFSET GuessHigh=10>

<!--- Pick a random number --->
<CFSET RandomNumber=RandRange(GuessLow, GuessHigh)>

<!--- Was a guess specified? --->
<CFSET HaveGuess=IsDefined("URL.guess")>

<!--- If specified, did it match? --->
<CFSET Match=(HaveGuess) AND (RandomNumber IS URL.guess)>

<!--- Feedback --->
<CFOUTPUT>
<CFIF Match>
   <!--- It matched --->
   You got it, I picked #RandomNumber#! Good job!
<CFELSEIF HaveGuess>
   <!--- Did not match --->
   Sorry, I picked #RandomNumber#! Try again!
<CFELSE>
   <!--- No guess specified, give instructions --->
   You did not guess a number.<BR>
   To guess a number, reload this page adding
   <B>?guess=n</B> (where n is the guess, for
   example, ?guess=5). Number should be between
   #GuessLow# and #GuessHigh#.
</CFIF>
</CFOUTPUT>

</BODY>
</HTML>

