Contents
CFScript
CFScript is an extension of CFML on the ColdFusion platform. CFScript resembles JavaScript. Some ColdFusion developers prefer it since it has less visual and typographical overhead than ordinary CFML.
Usage
Unless it is within a pure script-based ColdFusion Component, all CFScript code must be contained within a CFScript tag pair as follows: A simple example of a function: A simple example of a component in CFScript, containing two functions: 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 UDF:
Syntax
Since ColdFusion 8, CFScript has supported syntax abbreviations that are common in many other programming languages, such as "++", "<=" and "+=".
Arithmetic operators
Comments
CFScript has two forms of comments: single line and multiline.
Try / catch
Switch statement
Looping
For loop
FOR IN Loop
While loop
Do / while loop
Looping over an array
Differences from JavaScript
Although CFScript and JavaScript are similar, they have several key differences. The following list identifies CFScript features that differ from JavaScript:
This article is derived from Wikipedia and licensed under CC BY-SA 4.0. View the original article.
Wikipedia® is a registered trademark of the
Wikimedia Foundation, Inc.
Bliptext is not
affiliated with or endorsed by Wikipedia or the
Wikimedia Foundation.