maptakes a range and applies a function to each element in the range and returns a range with the results. A range is lazily evaluated, so you will not calculate any values ββunless you do something else with the range, for example, apply to it foreach.
eachapplies the function to each element in the range with impatience. Therefore, it eachis single line foreach.
auto range = iota(0, 10).map!(x => cast(float) x);
range.each!writeln;
source
share