User Guide
58 Chapter 4 Retrieving and Formatting Data
Reviewing the code
The following table describes the code and its function:
Code Description
<H2>We are sure you will agree it was
worth the short wait!</H2>
<cfflush>
Send the HTML header and all HTML
output to the
cfflush tag to the user.
This displays the explanatory paragraph
and H2 tag contents.
<cfflush interval=10>
Flush additional data to the user every
time at least ten bytes are available.
<cfloop index="randomindex" from="1"
to="200000" step="1">
<cfset random=Rand()>
</cfloop>
Insert an artificial delay by using the
Rand function to calculate many random
numbers.
<cfloop index="Myindex" from="1"
to="10" step="1">
<cfloop index="randomindex"
from="1" to="100000" step="1">
<cfset random=rand()>
</cfloop>
<cfoutput>
Magic number number #Myindex#
is: #RandRange
(100000,999999)#<br><br>
</cfoutput>
</cfloop>
Generate and display ten random
numbers. This code uses two loops. The
outer loop is repeated ten times, once for
each number to display. The inner loop
uses the rand function to create another
delay by generating more (unused)
random numbers. It then calls the
RandRange function to generate a
six-digit random number for display.