In this tutorial (), it is commented that if foreach support range is provided by member functions , Then a loop counter can only be obtained by calculating with the std.range module:
with the example.
import std.range; // ... foreach (i, element; number range (42, 47).) {Writefln ("% s:% s", i, element); }
I tried to use this example to check notation
, but I got the error error: a property of 'number range' For 'Multiplication' / code>. What could be wrong?
Import std.stdio; Import std.range; Void main () {foreach (i, element; iota (42, 47). Estimation) {writefln ("% s:% s", i, element); }}
BTW, you may or may not be aware of it, but you can use std.range.iota instead of number range.
No comments:
Post a Comment