If Statement with Declaration

Superstar64 via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 4 06:38:30 PDT 2016


On Thursday, 3 November 2016 at 22:32:17 UTC, Stefan Koch wrote:
> Just Introduce another block
> {
>   int i = someFunc();
>   if (i >= 0) { ... }
> }
> // i is not visible here

That adds 2 indention levels after formatting.

Unfortunately this doesn't work:
---
{
     int i = someFunc();
     if (i >= 0):
     //your code here
}
// i is not visible here
---


More information about the Digitalmars-d mailing list