• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 7. Implementing ColdFusion Loops > Implementing a For-Next Loop

Implementing a For-Next Loop

A for-next loop is essentially a counting loop. You provide a starting and ending value, and ColdFusion counts through the values between them, inclusive of the starting and ending values themselves. ColdFusion performs this operation with help from an index variable. Initially, the index variable is equal to the starting value, and it takes on all the values up through and including the ending value as ColdFusion progresses through the loop.

TIP

You can use the <cfloop> tag's optional step attribute to make the index variable increase by more than one each time through the loop. You can even set step to negative values to make ColdFusion count down instead of up! If you don't specify the step attribute, ColdFusion uses a default value of 1.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint