Railo allowing var'ing at any point in CFC

This is one of those features I know is coming in ColdFusion 9, but I don't know if its new in Railo 3.1.0.024 or been there for a while?

Anyway i've just found out you can "var" your variables in a CFC at any point. This isn't copying the way CF9 is planning on handling this by adding it to the LOCAL scope but it does mean you don't have to put everything at the top. Even though I'll most likely keep all my vars at the top for now its good to know that the following bit of code which in the past would throw an error now works fine.

[sourcecode language="plain"]<cffunction name="text" access="public" returntype="string" output="false"><cfset doSomethingFirst() /><cfset var b = "set second" /><cfreturn b /></cffunction>[/sourcecode]
comments powered by Disqus