let (x,y) = ...

John Colvin via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Feb 19 06:59:16 PST 2015


On Thursday, 19 February 2015 at 13:52:29 UTC, Nick Treleaven 
wrote:
> On 19/02/2015 04:38, thedeemon wrote:
>> int x, y, z, age;
>> string name;
>>
>> let (name, age) = getTuple();           // tuple
>> let (x,y,z) = argv[1..4].map!(to!int);  // lazy range
>> let (x,y,z) = [1,2,3];                  // array
>>
>> SomeStruct s;
>> let (s.a, s.b) = tuple(3, "piggies");
>
> Alternatively std.typetuple.TypeTuple can be used instead of let

not for ranges and arrays though


More information about the Digitalmars-d-announce mailing list