> Why is it "better"?  SetVariable is just another redundant function to
> learn, another syntax to look up.  I believe there actually IS some
> circumstance where you MUST use it, but I just can't recall when.
> 
> <CFSET "edname#numvar#" = "test"> does exactly what you would 
> expect and
> hope.  It's simple (as in Occam's Razor simple), elegant and 
> effective.  Why
> do string concatenation using ampersands instead of just 
> embedding variables
> inside your strings?  Is it a 'classier' technique, perhaps?


I tried to do something like this a while ago

<CFSET "variables.abc" & Evaluate(variables.somevalue + 1)  = "whatever">

and it fails (no function call on the LHS of an equals sign, or something
like that).

SetVariable to the rescue:

<CFSET variables.Result = Evaluate("variables.abc" & variables.somevalue +
1, "whatever")>

Ever since finding that out, I've avoided naming variables in the way you've
described above. I don't think there's anything inherently wrong with it
(you could create the variable name using another CFSET prior to this one),
but SetVariable just seems a bit more elegant.


-- 
Aidan Whitehall <[EMAIL PROTECTED]>
Netshopper UK Ltd
Advanced Web Solutions & Services

http://www.netshopperuk.com/
Telephone +44 (01744) 648650
Fax +44 (01744) 648651
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to