Skip to content

Instantly share code, notes, and snippets.

View sipacate's full-sized avatar

Dan Wilson sipacate

View GitHub Profile
@sipacate
sipacate / TagsVSScript.md
Created September 17, 2012 20:30
Basics

##ColdFusion Tags vs. ColdFusion Script

ColdFusion has been designed to allow the use of ColdFusion tags and ColdFusion script. Functionally, both will be interpreted equally and will achieve the same result. The use of ColdFusion Tags and ColdFusion Script is up to personal or team preference. There are one or two ColdFusion operations that are currently Tag only, as of this tutorial, but these will be made available in ColdFusion script in future releases.

Some developers write all ColdFusion code in Tags. Some developers write all ColdFusion code in Script. Some write the view portions of their ColdFusion code in Tags, and the business layer portion in Script. As long as you stay consistent, all approaches are valid. The overarching rule should be legibility and consistency.

Let's look at some statements and compare the differences:

Setting a variable:

@sipacate
sipacate / DataTypes.md
Created September 17, 2012 20:21
Basics

In our last Chapter, we talked about variables, data and how to transport data around in your application. There are different kinds of data and each helps in specific ways.

Strings/Numbers

Is Simple: Yes

Strings and numbers are very easy to work with. To set a string or a number, just use the CFSET command. You can append strings and numbers to each other using the & operator. See examples:

<cfset aString = "hi">

Programming is all about doing stuff to things. Generally, the stuff is the execution of a process or algorithm and the things are information or data.

An algorithm is just a fancy name for a series of steps, like tying your shoelaces. Information or data is just values or information. Your name is a piece of information and so is your birth date. Since it's shorter, in this article we'll use the word data to describe a piece of information.

In ColdFusion, data is held in variables. Think of a variable like a mailbox. You can stuff things like letters and packages into a mailbox and get them out later to do stuff. ColdFusion makes storing information very easy because it's a loosely typed Language. You can stick any kind of data into a ColdFusion variable without having to tell ColdFusion what kind of data it is.

Here's the simplest code to set a variable:

<cfset ThisIs = "fun">