number ranges
    forkit 
    forkit at gmail.com
       
    Mon Jan 17 21:37:31 UTC 2022
    
    
  
On Monday, 17 January 2022 at 11:58:18 UTC, Paul Backus wrote:
>
> This kind of half-open interval, which includes the lower bound 
> but excludes the upper bound, is used in programming because it 
> lets you write
>
>     foreach (i; 0 .. array.length) writef("%s ", array[i]);
>
> ...without going past the end of the array.
Yes. But the intent here is clearly stated and cannot be 
misunderstood -> array.length
Whereas 1..5 is just an opportunity to shoot yourself in the foot.
"the heretic must be cast out not because of the probability that 
he is wrong but because of the possibility that he is right." - 
Edsger W. Dijkstra
    
    
More information about the Digitalmars-d-learn
mailing list