number ranges

Tejas notrealemail at gmail.com
Wed Jan 19 02:58:32 UTC 2022


On Tuesday, 18 January 2022 at 17:58:54 UTC, H. S. Teoh wrote:
> On Tue, Jan 18, 2022 at 04:02:42PM +0000, Tejas via 
> Digitalmars-d-learn wrote: [...]
>> Newer languages nowadays use `start..<end` to denote the 
>> intent, think it's something we should follow?
>
> I've never seen that before.  Which languages use that?
>
>
> T

In Nim for example:

```
for n in 5 .. 9:  #Both 5 and 9 are included
   echo n

echo ""

for n in 5 ..< 9: #5 is included but 9 is excluded
   echo n
```

In Odin also:
```
for i in 0..<10 {
	fmt.println(i)
}
// or
for i in 0..9 {
	fmt.println(i)
}
```


More information about the Digitalmars-d-learn mailing list