Optional braces
Walter Bright
newshound2 at digitalmars.com
Wed Aug 24 09:22:36 PDT 2011
On 8/24/2011 1:09 AM, kennytm wrote:
> Not sure if it's a big enough problem, but what about dangling else of this
> form?
>
> if (a.length> 0)
> foreach (i, ref e; a)
> if (i> 0)
> e += a[i-1];
> else // oops
> throw new Exception("empty array");
That wouldn't be complained about with what I suggested. This isn't the dangling
else problem, though, it's just bad indenting.
More information about the Digitalmars-d
mailing list