Ok. but this isn't flexible.

On Wed, Oct 12, 2011 at 1:42 PM, bearophile <[email protected]> wrote:
> Gor Gyolchanyan:
>
>> no, yours will print
>> 1
>> 0
>> 0
>>
>> mine will print
>> 0
>> 1
>> 2
>> 3
>> 4
>> 5
>> 6
>> 7
>> 8
>> 9
>> 10
>> 11
>> ...
>> 100
>
> With DMD 2.055 this code:
>
> import std.stdio, std.range;
>
> void printRange(Range)(Range range) {
>    foreach (r; range)
>        writeln(r);
> }
>
> void main() {
>    printRange(iota(100));
> }
>
> Prints:
>
> 0
> 1
> 2
> ...
> 97
> 98
> 99
>
> Bye,
> bearophile
>

Reply via email to