4.3. Loops

Because custom functions are defined in ColdFusion script, you are likely to have written in this subset of the ColdFusion language. If you have, that is terrific, because writing loops in CFScript is almost identical to how you write loops and conditional logic statements in Java.

Because loops and conditional logic are a fundamental aspect of any programming language, there is little reason to do more here than examine the syntax, run some example programs so you can get a feel for it, and then move on.

4.3.1. The for Loop

The for loop is typically used to execute a code block a given number of times. The number of iterations is either known in advance or can be discerned at runtime. The syntax is like this:

 for (initialization; ...

Get Java™ for ColdFusion® Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.