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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

#i# and ##i## (pointing to different variable)

Status
Not open for further replies.

Wickersty

Programmer
Nov 13, 2002
51
0
0
US
Hi,

If i have a variable i, set to "1", which would be output as <CFOUTPUT>#i#</CFOUTPUT>

And I have a variable 1, set to "yes", which would be output as <CFOUTPUT>#1#</CFOUTPUT>

How could I use the value of i to check the valoue of 1.. meaning, <CFOUTPUT>##i##</CFOUTPUT> (which doesn't work b/c two ##s results in just outputting the character "#" and not trying to output a variable value).

Bottom line: I want to use the value of i to look for the value of of a second variable (i="1", so what is value of variable "1". i="2", so what is value of variable "2")

Thanks all,

Jeff
 
1" is an illegal variable name. It shouldn't work.

but you'd want to use the evaluate() function



A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
if you want to avoid evaluate() try this method (from live docs)

<cfset var1= "x">
<cfset "#var1#" = "My value">
<cfoutput>#x#</cfoutput>

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top