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

Name

SetVariable

Synopsis

                    SetVariable(variablename, value)

Assigns value to variablename where value is any passed value. SetVariable( ) is useful when you want to create dynamically named variables. The following example uses SetVariable( ) to assign values to several dynamically created variables:

<cfloop index="index" from="1" to="10">
  <cfset ValueOfVariable = SetVariable("MyVar#index#", #Index#)>
</cfloop>
   
<cfloop index="pos" from="1" to="10">
  <cfoutput>MyVar#pos# = #Evaluate("MyVar"&"#pos#")#<br></cfoutput>
</cfloop>


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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