|
|
|
|
|
by WalterBright
14 days ago
|
|
D has several usages for `foreach` depending on the number and type of its arguments. In this case, it sees that `vec` is an array, and so constructs a loop over the array. If `vec` was a range, the loop will be constructed as a loop over the array. It's nice because it makes the syntax for arrays and ranges interchangeable, making for easy refactoring. |
|