Content deleted Content added
No edit summary |
Improved existing citation and added Wiki links. |
||
Line 7:
== Usage ==
It is considered best practice to write ColdFusion Components and all business logic in CFScript and to use [[CFML]] only in .cfm files amongst [[HTML]].
All CFScript code must be contained within a CFScript tag pair as follows, unless it's within a pure script-based ColdFusion Component.
Line 18:
</source>
A simple example of a [[Subroutine|function]]:
<source lang="cfm">
<cfscript>
Line 42:
</source>
ColdFusion 11, [[Railo]] 4.1+, and [[Lucee]] 4.5+ both do their best to fully support cf tags in CFScript.
While there may not be direct substitutions for all tags, it is often still possible to achieve the results of a tag in script, but via a different syntax. For example, this is how to get a query into a variable in CFSCRIPT without writing a [[User-defined function|UDF]]:
<source lang="cfm">
<cfscript>
Line 55:
== Syntax ==
Since ColdFusion 8, CFScript has supported syntax abbreviations that are common in many other programming languages, such as "++", "<=" and "+=".<ref>
=== Arithmetic operators ===
|