Passing an Argument Collection in CFScript

26 Jan 2004

I've just been digging into ColdFusion again the past few days after working in Python exclusively for almost a month, and I almost forgot something pretty fundamental which I use a lot (since about 95% of my methods/functions in CFC's are typically written in CFScript these days). Something I had to recall, was how to pass an argument collection to a method/function. Well, it's quite easy, but not something that is easy to come across in the wild if you don't already know about it:

<cfscript> thisStruct = StructNew(); thisStruct.argA = 1; thisStruct.argB = 1; thisFunction(argumentCollection=thisStruct); </cfscript>

I'm also having to remember to use semicolon's again on the end of lines in CFScript, since in Python you just end a line with a CRLF.