Array Slice Ranges

Alexander Panek a.panek at brainsware.org
Thu Nov 9 06:48:52 PST 2006


Good point! Has my vote.

Bill Baxter wrote:
> 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