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
<mdino...@houseoffusion.com> 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
bboisv...@gmail.com
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:331227
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to