It was definitely added in CF9 but you are right, I don't see it listed in What's New in Coldfusion 9. Curious.
This is the reference page for this particular functionality however: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS328B9130-F922-4ddb-B78B-8817CA81F8E3.html Cheers, Judah On Mon, Mar 1, 2010 at 2:02 PM, Michael Dinowitz <[email protected]> wrote: > > I've just run a regex against the cfdocs and I can't find any > reference to this new chaining functionality. This implies it's a new > and overlooked functionality. I wonder what else is un-noted. > > Assignments in loop conditions has been around for a while. If it's a > CFLoop then you can only alter the loop operation with a condition. If > it's a loop within a script, you can use assignments at any time. It > allows for some 'silly' effects like this: > > <CFSCRIPT> > For (i="M";i NEQ "P"; i=Chr(Asc(i)+1)) > writeoutput(i&' '); > </CFSCRIPT> > > > > On Mon, Mar 1, 2010 at 4:40 PM, Barney Boisvert <[email protected]> wrote: >> >> A quick test indicates it's new in CF9. Worth mentioning that it is >> NOT treating the assignment as an expression, it is only allowing >> multiple variables to be assigned to a single expression. Your second >> test case would fail regardless of which one CF was doing, but this >> example also fails (meaning it's the latter): >> >> <cfset c=(b=a+1)+1> >> >> You can also use assignments in loop conditions. I think Ben blogged >> about that last summer. >> >> cheers, >> barneyb >> >> On Mon, Mar 1, 2010 at 1:33 PM, Michael Dinowitz >> <[email protected]> wrote: >>> >>> I think that I missed this in the docs. It seems that you can chain >>> set variables >>> >>> <cfset a=1> >>> <cfset c=b=a+1> >>> >>> This will give you a=1, b=2, c=2. >>> >>> On a related note, the following will fail >>> >>> <cfset a=1> >>> <cfset c=b+1=a+1> >>> >>> The chain works as long as there is no operation except on the >>> right-most item in the chain. >>> >>> This is all expected behavior in some other languages but I've never >>> seen it in CF. Anyone know when it was added? >>> >>> Please make me look like a fool for missing it. :) >>> >>> -- >>> Michael Dinowitz >>> >> >> >> >> -- >> Barney Boisvert >> [email protected] >> http://www.barneyb.com/ >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331230 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

