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

Looping

A loop construct usually consists of the same three elements. First, an expression takes place when the loop begins. Second, a condition is tested for each iteration and signals when the loop will conclude. Finally, an expression takes place when the loop ends. You create these three elements in various ways, using the <cfloop> tag depending on the type of loop you require. In a <cfscript> block, the loop elements also vary depending on type. The different types of loops available to <cfscript> are described in the following sections.

for Loop

A for loop is one of the most common loop constructs. In a for loop, as shown in the following code, the loop iterates as long as the condition remains true:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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