[Issue 7361] No documentation for front tuple expansion in foreach over range

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Mar 13 06:17:10 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=7361

Nick Treleaven <ntrel-pub at mybtinternet.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ntrel-pub at mybtinternet.com

--- Comment #5 from Nick Treleaven <ntrel-pub at mybtinternet.com> ---
While it's not documented in the spec, this feature is already documented in an
example in std.range.enumerate:

http://dlang.org/phobos/std_range.html#.enumerate

    foreach (lineNum, line; stdin.byLine().enumerate(1))
        stdout.writefln("line #%s: %s", lineNum, line);

--


More information about the Digitalmars-d-bugs mailing list