Learncfinaweek 1 5

Page 23

Data Types

In our last Chapter, we talked about variables, data, and how to transport data around in your application. Different data types serve different purposes.

Strings/Numbers Is Simple: Yes Strings and numbers are very easy to work with. To set a string or a number, use the cfset command. To append strings and numbers to each other, use the & operator: <cfset aString = "hi" /> <cfset aNumber = 42 /> <cfset aStringAndANumber = aString & aNumber /> aString: <cfoutput>#aString#</cfoutput> aNumber: <cfoutput>#aNumber#</cfoutput> aStringAndANumber: <cfoutput>#aStringAndANumber#</cfoutput> If you have a big block of strings to set, you can use the cfsavecontent command. <cfsavecontent variable="EmailContent"> Hi We want to send you a hoverboard. Let us know if you will accept this free offer. -Us </cfsavecontent> <cfoutput>#EmailContent#</cfoutput>

Dates Is Simple: Kind of Learn CF in a Week - Week 1

Page 15


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.