That's what <cfparam is for, isn't it?

-----Original Message-----
From: Rich Z [mailto:[EMAIL PROTECTED]
Sent: Friday, August 29, 2003 3:54 PM
To: CF-Talk
Subject: Efficient way to handle undefined variables


What is the best/most efficient way to handle a scenario where you're
populating variables from other variables that may or may not exist. If
they don't exist, an empty string should be assigned. I wrote a little
function to do this with a simple if statement inside:

If (isDefined("inVal")
{
            outVal = inVal;
}
else
{
            outVal = "";
}

Is this the best way to go about this? I'm going to end up wrapping
quite a few variables in this function, that's why I'm curious (I'm
puling in an XML that potentially has MANY optional variables).

Thanks,
Rich


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Reply via email to