Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFSET with or without a name

Status
Not open for further replies.

Glowball

Programmer
Oct 6, 2001
373
US
So I saw someone using CFSET differently than I thought we could use it. Ignore the functions or purpose below, just look at the CFSET part. I've always done

<cfset temp = ListAppend(myList, &quot;hello&quot;)>

but I saw

<cfset ListAppend(myList, &quot;hello&quot;)>

with no &quot;temp =&quot; part. Like doing CFSCRIPT in a CFSET tag or something. What do you all make of this? Any thoughts pro or con?

 
It's a commons practice by Allaire/Macromedia and other professionals. If you have less than 3 lines of such calls, then it's fine. Any more than that and it should be put into a <CFSCRIPT> tag.

Note, <cfset ListAppend(myList, &quot;hello&quot;)> will append &quot;hello&quot; to the list myList, but the variable won't keep it. This practice is mainly used with Structure and Array functions. - tleish
 
Cool, always thought a CFSET had to have an equals sign somewhere... nice shorthand!
 
It's somehow like printf (&quot;%d&quot;, temp = a + b); and printf (&quot;%d&quot;, a + b);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top