Scripting versus Tag-BasedCode
The goal of the ColdFusion scripting language is to make parts of ColdFusion functionality available in script-style syntax that developers may already be comfortable with.
This is not to say that everything done with ColdFtision’s tag-based syntax can be achieved through scriplS. Rather, any parts of ColdFusion that are truly programmatic (controlling flow, working with expressions, working with functions, and assigning variables) can be written in script syntax form. For instance, consider. the following program code:
CFIF Value is 1>
<CFSET Result· ‘One’)
<CFSET Result ~ ‘None’)
In ColdFusion script syntax, ‘the same code would be as follows:
if (value is 1)
Functionally these are the same. The choice of which approach to take depends on the preference of the developer.
The difference is even more pronounced when it comes to looping constructs. Although you can simulate all popular types of loops in programming languages such as ]avaScript and C by using the (FLClOP tag, the syntax of the tag itself does not make the purposes of the loop as readily apparent as they are in the scripting syntax.
For instance, the loop.
<CFlOOP INDEX-‘Value’ FROM-1 TO-S)
for (Value-1; Value less fhan 6; Value – Value + 1)
The latter is simply much clearer for an experienced developer coming from the world of traditional programming.