encyclopegia.org

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.

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. xParam = 115; yParam = 200; color = 'FFCC99'; A simple example of a function: function Sum(a, b) { var sum = a + b; return sum; } A simple example of a component in CFScript, containing two functions: component { public void function foo() { WriteOutput("Method foo() called "); } public function getString() { var x = "hello"; return x; } } 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: qGetData = new Query(); qGetData.setDataSource('#Application.datasource#'); qGetData.setSQL('SELECT column1, column2 FROM table WHERE 1'); qDateResult = qGetData.Execute().getResult(); Since ColdFusion 8, CFScript has supported syntax abbreviations that are common in many other programming languages, such as "++", " // This is a single-line comment. // This is a second single-line comment. /* This is a multiline comment. You do not need to start each line with a comment indicator. This line is the last line in the comment. */ try { throw(message="Oops", detail="xyz"); } catch (any e) { WriteOutput("Error: " & e.message); rethrow; } finally { WriteOutput("I run even if no error"); } switch (car) { case "Nissan": WriteOutput("I own a Nissan"); break; case "Toyota": WriteOutput("I own a Toyota"); break; default: WriteOutput("I'm exotic"); } for (i=1; i struct = StructNew(); struct.one = "1"; struct.two = "2"; for (key in struct) { WriteOutput(key); } //OUTPUTS onetwo x = 0; while (x x = 0; do { x = x + 1; WriteOutput(x); } while (x for (item in array) { doSomething(item); }

References

No reference rows published for this article.

Cite this article

MLA

"CFScript." encyclopegia.org, 2026, https://encyclopegia.org/wiki/cfscript. Accessed 23 November 2026.

Chicago

"CFScript." encyclopegia.org. Accessed November 23, 2026. https://encyclopegia.org/wiki/cfscript.

APA

encyclopegia.org. (2026). CFScript. Retrieved November 23, 2026, from https://encyclopegia.org/wiki/cfscript

Accessed November 23, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Shark tourism

enwiki · references available

Hopi Hari

enwiki · references available

Swedish military uniforms

enwiki · references available

Dominican franco

enwiki · references available

Britannic Majesty

enwiki · references available

ACC Athlete of the Year

enwiki · references available

FC Montceau Bourgogne

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1334303141 · 0.5 · snapshot enwiki-001334303141

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.