Just where has this language gone wrong?

Ali Çehreli acehreli at yahoo.com
Tue Jul 24 08:46:51 PDT 2012


On 07/24/2012 07:42 AM, Stuart wrote:

 > You mean it's already supported? Nice! Although, It'd still be awesome
 > to be able to do things like:
 >
 > auto a,b = bar();
 >
 > auto c,_ = bar();
 >

Works in foreach loops:

     foreach (a, b; hasTupleElements)

The element type of the following range of map results is a tuple:

import std.stdio;
import std.algorithm;

void main()
{
     auto values = [1.25, 2.50, 3.75];
     auto results = map!(a => a / 4, a => a * 10)(values);

     writeln(" Quarters  Ten Times");

     foreach (quarterResult, tenTimesResult; results) {
         writefln("%8.2f%8.2f", quarterResult, tenTimesResult);
     }
}

Ali



More information about the Digitalmars-d mailing list