Add to cfset

I have two variables simg & limg.
I also have a variable pnum.
How do I do a cfset for the following,
<cfset simg = #pnum# -1>
<cfset limg = #pnum# -2>
So if pnum = 1234, simg would equal 1234-1 and limg would equal 1234-2
usky1Asked:
Who is Participating?
 
ZvonkoConnect With a Mentor Systems architectCommented:
Like this:
<cfset simg = "#pnum#-1"  > 
<cfset limg = "#pnum#-2"  >

Open in new window

0
 
chrisP4DCommented:
im not really sure what you're asking because your code is right as far as setting variables up together, you just need to add

<cfset pnum = 1234>
before you do
<cfset simg = #pnum# -1>
<cfset limg = #pnum# -2>

do you need to display the result?
if so, just do
<cfoutput>
simg is equal to #simg# <br>
limg is equal to #limg# <br>
</cfoutput>
0
 
azadisaryevCommented:
or like this:

<cfset simg = pnum & "-1">
<cfset limg = pnum & "-2">
0
 
usky1Author Commented:
Thanks for your quick help on this.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.