mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-29 17:40:42 +02:00
Update coldfusion.html.markdown
Adds a few more examples
This commit is contained in:
@@ -25,8 +25,10 @@ ColdFusion is a scripting language for web development.
|
|||||||
|
|
||||||
<!--- Displaying simple data --->
|
<!--- Displaying simple data --->
|
||||||
<!--- Use <cfoutput> for simple values such as strings, numbers, and expressions --->
|
<!--- Use <cfoutput> for simple values such as strings, numbers, and expressions --->
|
||||||
<cfoutput>#myVariable#</cfoutput> <!--- myValue --->
|
<cfoutput>#myVariable#<br /></cfoutput> <!--- myValue --->
|
||||||
<cfoutput>#myNumber#</cfoutput> <!--- 3.14 --->
|
<cfoutput>#myNumber#<br /></cfoutput> <!--- 3.14 --->
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
<!--- Declaring complex variables --->
|
<!--- Declaring complex variables --->
|
||||||
<!--- Declaring an array of 1 dimension: literal or bracket notation --->
|
<!--- Declaring an array of 1 dimension: literal or bracket notation --->
|
||||||
@@ -40,19 +42,23 @@ ColdFusion is a scripting language for web development.
|
|||||||
|
|
||||||
<!--- Operators --->
|
<!--- Operators --->
|
||||||
<!--- Arithmetic --->
|
<!--- Arithmetic --->
|
||||||
<cfoutput>#1 + 1#</cfoutput> = 2
|
<cfoutput>#1 + 1#<br /></cfoutput> = 2
|
||||||
<cfoutput>#10 - 8#</cfoutput> = 2
|
<cfoutput>#10 - 8#<br /></cfoutput> = 2
|
||||||
<cfoutput>#1 * 2#</cfoutput> = 2
|
<cfoutput>#1 * 2#<br /></cfoutput> = 2
|
||||||
<cfoutput>#10 / 5#</cfoutput> = 2
|
<cfoutput>#10 / 5#<br /></cfoutput> = 2
|
||||||
<cfoutput>#12 % 5#</cfoutput> = 0
|
<cfoutput>#12 % 5#<br /></cfoutput> = 0
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
<!--- Comparison --->
|
<!--- Comparison --->
|
||||||
<cfoutput>#1 eq 1#</cfoutput> <!--- TRUE --->
|
<cfoutput>#1 eq 1#<br /></cfoutput> <!--- TRUE --->
|
||||||
<cfoutput>#15 neq 1#</cfoutput> <!--- TRUE --->
|
<cfoutput>#15 neq 1#<br /></cfoutput> <!--- TRUE --->
|
||||||
<cfoutput>#10 gt 8#</cfoutput> <!--- TRUE --->
|
<cfoutput>#10 gt 8#<br /></cfoutput> <!--- TRUE --->
|
||||||
<cfoutput>#1 lt 2#</cfoutput> <!--- TRUE --->
|
<cfoutput>#1 lt 2#<br /></cfoutput> <!--- TRUE --->
|
||||||
<cfoutput>#10 gte 5#</cfoutput> <!--- TRUE --->
|
<cfoutput>#10 gte 5#<br /></cfoutput> <!--- TRUE --->
|
||||||
<cfoutput>#1 lte 5#</cfoutput> <!--- TRUE --->
|
<cfoutput>#1 lte 5#<br /></cfoutput> <!--- TRUE --->
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
<!--- Control Structures --->
|
<!--- Control Structures --->
|
||||||
<cfset myCondition = "Test" />
|
<cfset myCondition = "Test" />
|
||||||
@@ -63,36 +69,17 @@ ColdFusion is a scripting language for web development.
|
|||||||
<cfelse>
|
<cfelse>
|
||||||
myCondition is unknown
|
myCondition is unknown
|
||||||
</cfif>
|
</cfif>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<!--- Loops --->
|
||||||
|
<cfloop from="0" to="10" index="i">
|
||||||
|
<cfoutput>#i# <br /></cfoutput>
|
||||||
|
</cfloop>
|
||||||
|
|
||||||
|
<hr />
|
||||||
```
|
```
|
||||||
<!-- // While loop
|
<!--
|
||||||
int fooWhile = 0;
|
|
||||||
while(fooWhile < 100) {
|
|
||||||
System.out.println(fooWhile);
|
|
||||||
// Increment the counter
|
|
||||||
// Iterated 100 times, fooWhile 0,1,2...99
|
|
||||||
fooWhile++;
|
|
||||||
}
|
|
||||||
System.out.println("fooWhile Value: " + fooWhile);
|
|
||||||
|
|
||||||
// Do While Loop
|
|
||||||
int fooDoWhile = 0;
|
|
||||||
do {
|
|
||||||
System.out.println(fooDoWhile);
|
|
||||||
// Increment the counter
|
|
||||||
// Iterated 99 times, fooDoWhile 0->99
|
|
||||||
fooDoWhile++;
|
|
||||||
} while(fooDoWhile < 100);
|
|
||||||
System.out.println("fooDoWhile Value: " + fooDoWhile);
|
|
||||||
|
|
||||||
// For Loop
|
|
||||||
int fooFor;
|
|
||||||
// for loop structure => for(<start_statement>; <conditional>; <step>)
|
|
||||||
for (fooFor = 0; fooFor < 10; fooFor++) {
|
|
||||||
System.out.println(fooFor);
|
|
||||||
// Iterated 10 times, fooFor 0->9
|
|
||||||
}
|
|
||||||
System.out.println("fooFor Value: " + fooFor);
|
|
||||||
|
|
||||||
// For Each Loop
|
// For Each Loop
|
||||||
// The for loop is also able to iterate over arrays as well as objects
|
// The for loop is also able to iterate over arrays as well as objects
|
||||||
// that implement the Iterable interface.
|
// that implement the Iterable interface.
|
||||||
|
Reference in New Issue
Block a user