[Language construct idea] The for loop with prepare step

H. S. Teoh hsteoh at qfbox.info
Tue Feb 13 18:19:40 UTC 2024


On Tue, Feb 13, 2024 at 01:59:36PM +1300, Richard (Rikki) Andrew Cattermole via Digitalmars-d wrote:
[...]
> ```d
> foreach(...) {
> 
> } while {
> 
> }
> ```

The problemm with this syntax is that it looks too much like two
consecutive loops:

```d
foreach(...) {
}
while (...) {
}
```

Maybe a better syntax might be:

```d
foreach(...) {
} continue {
}
```

So it becomes clear that the second block is part of the loop.


T

-- 
Chance favours the prepared mind. -- Louis Pasteur


More information about the Digitalmars-d mailing list