Unexpected behaviour of foreach statement

rikki cattermole rikki at cattermole.co.nz
Fri Mar 2 10:24:54 UTC 2018


On 02/03/2018 11:21 PM, Arredondo wrote:
> Hi,
> 
> The following works as expected:
> 
> auto range = [1, 2, 3, 4, 5];
> foreach (i, el; range) {
>      writeln(i, ": ", el);
> }

s/range/array/

Arrays have a different foreach syntax than ranges do.


More information about the Digitalmars-d-learn mailing list