number ranges
forkit
forkit at gmail.com
Wed Jan 19 04:06:05 UTC 2022
On Wednesday, 19 January 2022 at 03:00:49 UTC, Tejas wrote:
> On Tuesday, 18 January 2022 at 20:43:08 UTC, forkit wrote:
>> On Tuesday, 18 January 2022 at 16:02:42 UTC, Tejas wrote:
>>>
>>> Newer languages nowadays use `start..<end` to denote the
>>> intent, think it's something we should follow?
>>
>> I've decided to avoid using number ranges 'directly', and
>> instead use a wrapper function...
>>
>>
>> auto range(T:T)(T a, T b)
>> {
>> import std.range : iota;
>> return iota(a, (b+1));
>> }
>
> Aww, come on; it ain't that bad...
Well that depends on entirely on what the code is doing ;-)
The key is to *always* *remember* the stop index is not included.
I sure hope they 'remembered' this in the code running on that
telescope floating out into open space...
More information about the Digitalmars-d-learn
mailing list