mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
1e7f639755
Fixes a typo
11 KiB
11 KiB
language | contributors | filename | |||
---|---|---|---|---|---|
ColdFusion |
|
LearnColdFusion.cfm |
ColdFusion is a scripting language for web development. Read more here.
<!--- Comments start with "<!---" and end with "--->" --->
<!---
Comments can
also
span
multiple lines
--->
<!--- CFML tags have a similar format to HTML tags. --->
<!--- Variable Declaration: Variables are loosely typed, similar to javascript --->
<cfset myVariable = "myValue" />
<cfset myNumber = 3.14 />
<!--- Displaying simple data --->
<!--- Use <cfoutput> for simple values such as strings, numbers, and expressions --->
<cfoutput>#myVariable#</cfoutput> <!--- myValue --->
<cfoutput>#myNumber#</cfoutput> <!--- 3.14 --->
<!--- Declaring complex variables --->
<!--- Declaring an array of 1 dimension: literal or bracket notation --->
<cfset myArray1 = [] />
<!--- Declaring an array of 1 dimension: function notation --->
<cfset myArray2 = ArrayNew(1) />
<!--- Outputting complex variables --->
<cfdump var="#myArray1#" /> <!--- An empty array object --->
<cfdump var="#myArray1#" /> <!--- An empty array object --->
<!--- Operators --->
<!--- Arithmetic --->
<cfoutput>#1 + 1#</cfoutput> = 2
<cfoutput>#10 - 8#</cfoutput> = 2
<cfoutput>#1 * 2#</cfoutput> = 2
<cfoutput>#10 / 5#</cfoutput> = 2
<cfoutput>#12 % 5#</cfoutput> = 0
<!--- Comparison --->
<cfoutput>#1 eq 1#</cfoutput> <!--- TRUE --->
<cfoutput>#15 neq 1#</cfoutput> <!--- TRUE --->
<cfoutput>#10 gt 8#</cfoutput> <!--- TRUE --->
<cfoutput>#1 lt 2#</cfoutput> <!--- TRUE --->
<cfoutput>#10 gte 5#</cfoutput> <!--- TRUE --->
<cfoutput>#1 lte 5#</cfoutput> <!--- TRUE --->
<!--- Control Structures --->
<cfset myCondition = "Test" />
<cfif myCondition eq "Test">
<cfoutput>#myCondition#</cfoutput>
<cfelseif myCondition eq "Production">
<cfoutput>#myCondition#. Proceed Carefully!!!</cfoutput>
<cfelse>
myCondition is unknown
</cfif>
Further Reading
The links provided here below are just to get an understanding of the topic, feel free to Google and find specific examples.