unpacking

Jonathan M Davis jmdavisProg at gmx.com
Tue Dec 7 09:52:17 PST 2010


On Tuesday, December 07, 2010 09:29:18 spir wrote:
> Hello D people,
> 
> Is there a way to unpack an array into local vars, as:
> 	auto x = [1,2,3];
> 	a,b,c = x;

No. There is no way to do multiple assignments to the left of an assignment 
operator. The only way that you can do multiple assignments on one line is to 
assign multiple variables to the same value. e.g.

i = j = k = l;

And that's not what you're trying to do.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list