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

Nested Loops

Like the <cfif> and <cfswitch> statements, loops can be nested. Nesting loops lets you create extremely powerful code, as long as you are very careful in constructing the loops. Listing 9.13 contains a practical example of nested loops, using three loops to display a table of Web browser–safe colors (seen in Figure 9.10). Save the code as loop3.cfm.

Figure 9.10. Displaying the Web browser–safe color palette requires the use of three nested loops.
Listing 9.13. loop3.cfm
<!--- Name: loop3.cfm Author: Ben Forta (ben@forta.com) Description: Demonstrate use of nested loops Created: 07/01/2007 ---> <html> <head> ...

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