November 29, 2006

Will CFMX8 have cfcontinue?

There are a couple of nice statements you can use to control processing within loops, namely

  • break
  • continue

Break is of course used to exit the current loop entirely and resume page processing from the first CF statement after the end loop tag. Lovely!

Continue has a subtle but handy difference, it ends the current loop iteration and ‘continues’ from the beginning of the next loop iteration. Very lovely :)

Now the problem is that there is no ColdFusion tag equivalent for continue, it’s only accessible when in a <cfscript> block. As far as I know this is the only statement in the CFML language which is available in <cfscript> but not tags :(

For some scenarios this will be ok, especially for the cfscripters out there. But for people who don’t like (for several reasons) <cfscript> then this is a limitation which I hope Adobe will address (among others!) in Scorpio.

And don’t forget that the inherent limitations of <cfscript> (limited cftag support) means that sometimes you won’t be able to do your logic in cfscript. For example you may want to use a <cfsavecontent> etc which you can’t do in <cfscript>.

I know…I know that you can create your own functions simulating tag functionality in cfscript but all gets a little messy doesn’t it?

© Michael Sharman 2017