CFSET assigns a value to a variable.

CFPARAM makes sure a variable exists (with a given default value if
specified).

The two ideas are a little different.

If I have passed a URL variable to my page (call it URL.MyVar), then I can
do processing on my page using that variable.

However, if I do not pass that URL parameter, yet still have processing
using URL.MyVar, then my page will crash complaining that URL.MyVar doesn't
exist.  That's where CFPARAM comes in.  It makes sure the variable exists,
and allows you to specify a default value.  So, by adding a CFPARAM for
URL.MyVar, my page will process without error (assuming I've done a good job
of everything else).  The results may be unexpected if you don't handle a
default value, but the page doesn't crash, which is rather important.

hmmmmm not sure if that's clear enough.  But here's hoping.

Shawn Grover

-----Original Message-----
From: Fuon See Tu [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 04, 2001 2:49 PM
To: CF-Talk
Subject: CFPARAM vs. CFSET


Hey guys i still don't understand the difference between CFPARAM and CFSET.

anyone got a working concept?  i see no use for CFPARAM :)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to