What You Must Know About ColdFusion Flow-Controls (Page 1 of 6 )
Flow control tags exist to control how a program proceeds. Coldfusion uses conditional processing tags to control the flow. This article covers some of the more important flow control tags in the language, as well as script equivalents.
Flow is the essence of dynamism, and everything living and dynamic has built-in mechanisms to control flow. Programming languages are no exception. They have logic built-in to control how the program proceeds. Procedural languages like FORTRAN and others (even VB6) had a Goto that diverted the flow to take different paths based on decisions. ColdFusion, too, controls the flow of programs by using conditional processing tags, or via <cfscript/>. These conditions may be of different kinds. Some are associated with processing logic which is associated with user input; some depend on certain inherent time triggered events, some others are based on achieving certain pre-determined values of variables, and so forth.
Flow Control TagsMacromedia documentation details the various categories of flow-control tags that are available as follows:
- Flow-control: Control of flow from line after line of code processing, to processing lines based on conditions:
- cfabort
- cfbreak
- cfcase
- cfdefaultcase
- cfswitch
- cfif
- cfelse
- cfelseif
- cfloop
- Flow-control and extensibility:
- Flow-Control and Debugging:
- Flow-Control and page Processing:
- Flow-Control and Exception handling:
- cftry
- cferror
- cfthrow
- cfrethrow
In this tutorial, the flow-control tags used to control the flow of processing of a file from the normal, default flow direction to some other direction will be discussed. These tags are the ones that show up first in the above list. The other tags in the list are also associated with flow of other kinds. In addition to the tags, <cfscript/> based flow-control is also described.
Next: What if, and where to scenarios >>
More ColdFusion Articles
More By Jayaram Krishnaswamy