Daemonite: Setting function vars in CFSCRIPT Archive

Daemonite: Setting function vars in CFSCRIPT Archive


Tuesday, September 14, 2004
Setting function vars in CFSCRIPT

Great! You can var variables for functions inside of CFSCRIPT blocks. This may be old news for many folks as it's a CFMX 6.1 change. But it's something I've only recently stumbled across.

Pre-Redsky you were forced to set vars like this:

<cffunction name="getFoo">
<cfargument name="objectid">
<cfset var stReturn=structnew()>
<cfscript>
//my funky magic
</cfscript>
<cfreturn stReturn>
</cffunction>

I found this real frustrating, especially since I'm a CFSCRIPT fan. Of course these days you can do things like so:

<cffunction name="getFoo">
<cfargument name="objectid">
<cfscript>
var stReturn=structnew();
//my funky magic
</cfscript>
<cfreturn stReturn>
</cffunction>

Oh well.. bury your head in the sand and you miss these things I guess.

Posted by modius at 01:06 PM | Permalink
Trackback: http://blog.daemon.com.au/cgi-bin/dmblog/mt-tb.cgi/245

Comments