You are on page 1of 2
CFSCRIPT ColdFusion Cheat Sheet User Defined Function (UDF) FOR Loop for (ints1 LTE ArvayLen(array):ieist) ¢ weiteoutput(arrayli])s Switch Case ssteh(frute ¢ et teoutput (°T ke Apples"); es teoutput (°T breaks defautt We teoutput ("1 Ske Oranges"); Ske fruit"); While Loop winste (U1 5) output); Hroteurs 12345 Assign a variable foo = "bar"; CFScript Component component extends-"Fruit” outpute"False" { public boolean function SsGood() { ) private void est(required numeric bit, es) 1140 suse FOR IN Loop (Structure) structNew()s for (key in struct) { Writeoutput (key) T1OuTPUTS onetwo Fs.) FOR IN Loop (Array) function furky(mojo) { var dojo = @ 4 (argunents.nojo £9 dojo) ¢ return "Rojo": ) else ( return “no-nojo"s ) If Else If / Else SF (Frust 15 apple”) { Wetteoutput(°T tke apples"); > felse SF (Fruit 15 “orange") Wetteoutput("T ike oranges”); > else ¢ Wetteoutput(*E tke frase); > Do/ While Loop aot Wei tedutput(x); Yate (x LTE 9); Wy osteuTs + Single Line Comment ojo = 15 //ThIS 15 A comeNT Try / Catch / Throw / Finally / Rethrow try ca J cateh (any &) > inanty (1/1 throw(message-"Oops", detatl<"y2")5 puE("E run even 1F no error”) Muttiine Comment J This is 2 coment ” FOR IN Loop (Query) 4 esmessage)s cars = ("Ford "Dodge" cars = @ueryew(“nakesnodel", for (car in cars) ¢ f_sal_varchar,cf_sal_varchar", wriveoutout (cards (Core™, “1, [-Deege", "98°13 > for (car in cars) © rau1PUIS Fordoocee writeoutput("Hodel " & car-nodel); ) T1O.TPUTS Wedel Thode 38 CFinclude (er+] Transactions Include “template, cta"s transaction { a0 stutt 1 (g008) transaction action="conmit ease ¢ transaction actton="rotiback , > Struct Literal Array Literal product = {1 ager); fruit = ["apples", “oranges ]; ‘Tip: Dont forget to include a semicoln ; after each statement! ‘Questions, comments, erlicism, ar requests can be drected Hero (hilp:/www-potetrotag.comvcontact) (tetoundes om) foundeg [Copyright © 2007-2014 Peter Fog hp paltiag con) (Miwa polakog.comf, Al Rights ‘Reserved. This document may b pnnedfesly a long a5 his noc stays tact rrp eatetscomuamnticdeacrtars

You might also like