CFML Conditionals/Loops / Nested Loops
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.
Learn More
Subtitles of the Movie
What we're going to take a look at now are Nested Loops and I'm going to use the index loop to represent our nested loops in this example. I think it's a little bit easier to see that it's looping when it's a number. So I have the code up here, Lines 13 through 20. As I stated previously you are better off typing this out, but I give you the code example right here, but I can guarantee you, you don't want to have to sit and wait for me to type this out, so let's run the code and then we'll come back to the actual code to create each section. So what we have here is an outer loop and that outer loop is running through the numbers from 1 all the way up to 100, just trust me on that one. And the inner loop is running the numbers between 100 and 200 incrementing by 20, so we have two loop actions going on here. So how does this work? Well, our outer loop is on Line 23 and 30 and our outer loop is the one that's going from numbers 1 to 100, so that outer loop runs then it moves to the inner loop. So the outer loop prints the number from 1 to 100 starting at 1, then it moves into an inner loop that it's going to print out the number 1 then it's going to loop through from number 100 to number 200 with i representing the number at each item in the list stepping, in other words, incrementing the numbers by 20. The list itself, the bullets are coming from our UL Tags here and our LI Tags here are actually creating the bullets and each one's on its own line because of the Break Tag. So, that is the code being used to create our list. So this code runs, Line 23, then Line 24, then Line 25 continues to loop through until that condition is no longer true, then it moves back out to the outer loop, prints it out, runs through the inner loop and that process goes over and over again until this condition in the loop is true and this condition in the loop is true. So that is where we got our printed page. So that is two Nested index Loops and showing you how to nest those loops.
Tutorial Information
| Course: | Adobe ColdFusion 8 |
| Author: | Candyce Mairs |
| SKU: | 34093 |
| ISBN: | 1-936334-05-4 |
| Release Date: | 2010-02-26 |
| Duration: | 8 hrs / 112 lessons |
| Work Files: |
Yes |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 