• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. Using ColdFusion > Using Variables

Using Variables

Now that you've had the chance to use some basic functions, it's time to introduce variables. Variables are an important part of just about every programming language, and CFML is no exception. A variable is a container that stores information in memory on the server. Variables are named, and the contents of the container are accessed via that name. Let's look at a simple example. Type the code in Listing 8.4 into a new file (feel free to use your own name instead of mine), save it as hello4.cfm, and browse it. You should see a display similar to the one shown in Figure 8.7.

Listing 8.4. hello4.cfm

<html>
<head>
 <title>Hello 4</title>
</head>

<body>

<cfset FirstName="Ben">

<cfoutput>
Hello #FirstName#, and welcome to ColdFusion!
</cfoutput>

</body>
</html>


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint