Railo 4 supports closures (a.k.a. anonymous functions) in ColdFusion.
I’ve been playing with the different ways of using them in the various apps I am building at Straker Translations.
Today there was a need to loop over the keys of a structure (a.k.a. associative arrays) and add the value of all the keys.
The usual idiom of regular ColdFusion code would be to use <cfloop> to go over all the keys and do the addition.
With Railo closures it is much simpler. Here is the code:
It is simple and elegant. Makes the code much more succinct and powerful.