Skipping or Stepping Through an Array?

drug drug2004 at bk.ru
Wed Oct 21 12:06:00 UTC 2020


There are two other way:
```D
import std;

void main()
{
     int[] a = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ];

     // using foreach
     foreach (i; 0..a.length)
         write(a[i], ", ");
     writeln;

     // using stride
     writeln(stride(a, 2));
}
```


More information about the Digitalmars-d-learn mailing list