Array Slice Ranges

Bill Baxter wbaxter at gmail.com
Thu Nov 9 04:47:12 PST 2006


Mike Parker wrote:
> Alexander Panek wrote:
> 
>> I'd really like to have a distinction between exclusive and inclusive 
>> slicing. Maybe '..'(inclusive) and '..-'(exclusive) or similar, with 
>> '..' => '..-'. Not *that* beautiful, though .. maybe someone has a 
>> better suggestion.
>>
> 
> What about leaving ... as is and using ..+, or ...+, for inclusive?

Ooh, how about:
   [1..=3]

just like for loops, the difference between inclusive and exclusive is 
one '=' sign

   for (i=0; i<10; i++) ... // exclusive
   for (i=0; i<=10; i++) ...// inclusive

I thing the meaning of a..=b would be   easier to guess and remember.

--bb



More information about the Digitalmars-d mailing list