[Submission] D Slices

Mafi mafi at example.org
Tue May 31 10:12:22 PDT 2011


Am 31.05.2011 18:16, schrieb eles:
> Now, why:
>
> for(iterator from a[0] to a[N-1]){ //etc. }
> //let use the above notation for for(i=0; i<=N-1; i++)
>
> is acceptable, but sudden is no more acceptable to write
>
> a[for(iterator from 0 to N-1)]
>
> and one must use
>
> a[for(iterator from 0 to N]]
>
> in order to achieve exactly the same?
>
> The last two expressions are just mental placeholders for a[0..N-1]
> and for a[0..N] respectively.

let
for(element from a[0] to a[n])
be a notation for
for(i=0; i < n; i++)

but then, assuming closed intervals, why do I have to write
a[i..n-1] to archive the same?

You see? This argument of yours is not really good.

Mafi


More information about the Digitalmars-d mailing list