Do Loop with Variable

jmh530 john.michael.hall at gmail.com
Tue Jul 8 17:24:11 UTC 2025


On Tuesday, 8 July 2025 at 16:40:24 UTC, Quirin Schroll wrote:
> I have the feeling this isn’t gonna fly, but I’ll say it 
> anyways because maybe someone finds a solution.
> ```d
> do (int x = 0)
> { }
> while (++x < 10);
> ```
> which would be equivalent to
> ```d
> {
>     int x = 0;
>     do
>     { }
>     while (++x < 10);
> }
> ```
> [snip]

What is your motivation for this? Making sure `x` doesn't stay 
around or making sure it doesn't conflict with `x` elsewhere in 
the program?



More information about the dip.ideas mailing list