C++ still doesn't have good loop syntax

Walter Bright newshound2 at digitalmars.com
Mon Aug 10 00:08:04 UTC 2026


On 8/9/2026 10:25 AM, Mindy Batek (0xEAB) wrote:
 > foreach ($vec as $i => $s)
> With this syntax, I've never had to wonder which variable was the key and which 
> was the value.

It's easy to remember. Nobody says value-key. It's always key-value!
```d
foreach (i, s; vec)
```
Much more compact, too.



More information about the Digitalmars-d mailing list