Whatever message this page gives is out now! Go check it out!
lval = expression;x = "positive";
y = x;
a[3]=5;
structure.member=10;
ArrayCopy=myArray;StructInsert(employee,"lastname",FORM.lastname);if(expr) statement [else statement]if(value EQ 2700)
message = "You've reached the maximum";if(score GT 1)
result = "positive";
else
result = "negative";if(score GT 1)
result = "positive";
else if(score EQ 0)
result = "zero";
else
result = "negative";if(score GT 1) {
result = "positive";
message = "The result was positive.";
}
else {
result = "negative";
message = "The result was negative.";
}switch (expression) {
case constant: [case constant:]... statement(s) break;
[case constant: [case constant:]... statement(s) break;]...
[default: statement(s)] }switch(name) {
case "John": case "Robert":
male=True;
found=True;
break;
case "Mary":
male=False;
found=True;
break;
default:
found=False;
} //end switch<cfswitch expression="#(() => 1)()#" >
<cfcase value="5">I like kiwi!</cfcase>
<cfcase value="#(5 GT 1)#">I like Orange!</cfcase>
<cfdefaultcase>Fruit, what fruit?</cfdefaultcase>
</cfswitch><cfscript>
s=-1
switch((()=> 1)()) {
case 3/4:
writeoutput("22")
break;
case s+ 2:
writeoutput("21")
break;
}
</cfscript><cfscript>
s=123
switch((()=> 123)()) {
case s:
writeoutput("21")
break;
}
</cfscript><cfscript>
s = 125;
switch((()=> 125)()) {
case 20 :
default :
writeoutput("6")
break;
case s :
writeoutput("21")
break;
}
switch((()=> 125)()) {
case s :
case 125 :
writeoutput("21")
break;
default :
writeoutput("6")
break;
}
switch((()=> 125)()) {
default :
writeoutput("6")
break;
case 125 :
writeoutput("21")
break;
}
</cfscript><cfscript>
public string function f() {
return "yes"
}
switch((()=> "yes")()) {
case round(3.14159):
writeoutput("22")
break;
case f():
writeoutput("23")
break;
default:
writedump("via UDF")
}
</cfscript><cfscript>
s = 123
switch((()=> 125)()) {
case -(-s) + 2:
writeoutput("22")
break;
}
</cfscript><cfscript>
switch((()=> "hi")()) {
case (5 GT 1)? "h" & "i" : "hello" :
writeoutput("21")
break;
}
</cfscript><cfscript>
switch((()=> "hi")()) {
case "h" & "i" :
writeoutput("21")
break;
}
</cfscript><cfscript>
public string function f() {
return "yes"
}
switch((()=> true)()) {
case f() && false:
writeoutput("23")
break;
case !f():
writeoutput("22")
break;
case !(6 - 3 * 2):
writeoutput("22")
break;
}
</cfscript><cfswitch expression="#(() => 1)()#" >
<cfcase value="#(()=> 1)()#" >I like kiwi!</cfcase>
</cfswitch><cfscript>
b = [2, 21, 211]
switch((()=> 1)()) {
case 1 + Round(3.14159)/Round(3.14159):
writeoutput("22")
break;
case b[1] - 1:
writeoutput("21")
break;
}
</cfscript><cfscript>
b = { e = 2, f = 21, g = 211}
switch((()=> 21)()) {
case b.e:
writeoutput("2");
break;
case b.f:
writeoutput("21") ;
break;
}
</cfscript>for (initial-expression; test-expression; final-expression) statementA LT 5
index LE x
status EQ "not found" AND index LT endfor(index=1;
index LTE 10;
index = index + 1)
a[index]=index;<cfscript>
strings=ArrayNew(1);
ArraySet(strings, 1, 10, "lock");
strings[5]="key";
indx=0;
for( ; ; ) {
indx=indx+1;
if(Find("key",strings[indx],1)) {
WriteOutput("Found key at " & indx & ".<br>");
break;
}
else if (indx IS ArrayLen(strings)) {
WriteOutput("Exited at " & indx & ".<br>");
break;
}
}
</cfscript>a = ArrayNew(1);
loop = 1;
while (loop LE 10) {
a[loop] = loop * 5;
loop = loop + 1;
}do statement while (expression);a = ArrayNew(1);
loop = 1;
do {
a[loop] = loop * 5;
loop = loop + 1;
}
while (loop LE 10);a = ArrayNew(1);
loop = 0;
do {
loop = loop + 1;
a[loop] = loop * 5;
}
while (loop LT 10);<cfquery ... name="myQuery">
... sql goes here...
</cfquery>
<cfscript>
if (myQuery.RecordCount gt 0) {
currRow=1;
do {
theValue=myQuery.myField[CurrRow];
currRow=currRow+1;
} while (currRow LTE myQuery.RecordCount);
}
</cfscript>for (variable in structure) statementmyStruct=StructNew();
myStruct.productName="kumquat";
mystruct.quality="fine";
myStruct.quantity=25;
for (keyName in myStruct) {
WriteOutput("myStruct." & Keyname & " has the value: " &
myStruct[keyName] &"<br>");
}for ( loop=1; loop LE 10; loop = loop+1) {
if(a[loop] EQ "") continue;
WriteOutput(loop);
}strings=ArrayNew(1);
ArraySet(strings, 1, 10, "lock");
strings[5]="key";
strings[9]="key";
indx=0;
for( ; ; ) {
indx=indx+1;
if(Find("key",strings[indx],1)) {
WriteOutput("Found a key at " & indx & ".<br>");
}
else if (indx IS ArrayLen(strings)) {
WriteOutput("Array ends at index " & indx & ".<br>");
break;
}
}public String foo(array a)
{
for(var item in a)
{
writedump(item);
}
}<cfquery name="arts" datasource="cfartgallery">
select * from art
</cfquery>
<cfscript>
cols = listToArray(listsort(arts.columnlist, "textnocase"));
for(row in arts)
{
for(col in cols)
writeoutput(arts.currentrow & " ..." & col & ": " & row[col] & "<br>");
writeoutput("<hr>");
}
</cfscript>public String foo(struct s)
{
for(var item in s)
{
writedump(item & ": " & s[item]);
}
writedump(local);
}<cfscript>
a = CreateObject("java","java.util.Arrays").AsList(ToString("CF,10,Zeus").split(","));
for (var1 in a) {
WriteOutput(var1);
}
</cfscript>// For Loop:
<OuterLabel> : for(){
<InnerLabel> : for(){
break OuterLabel;
continue OuterLabel;
}
}*// While Loop:
<OuterLabel> : while(){
<InnerLabel> : while(){
break OuterLabel;
continue OuterLabel;
}
}<cfscript>
xyz : for(i=110;i<115;i++){
abc : for(j=10;j<20;j++) {
writeDump(i);
if(j%3 == 0)
continue xyz;
writeDump(j);
}
writeDump("<br>");
}
</cfscript><cfscript>
// breaking out using a label
x = 0;
WhileLabel: while (x < 10){
writeOutput("x is #x#<br>");
switch (x){
case 1:
break;
case 3:
break WhileLabel;
}
x++;
writeOutput("end of of loop<br>");
}
writeOutput("After loop, x is #x#<br>");
</cfscript><cfloop index="i" from="1" to="10" label="xyz">
<cfoutput>#i#</cfoutput>
<br>
<cfif i Ge 5>
<cfcontinue xyz>
</cfif>
<cfoutput>#i#->#i#</cfoutput>
<br>
</cfloop>