Patterns of Bugs

torhu no at spam.invalid
Sat Jan 8 09:57:43 PST 2011


On 08.01.2011 15:13, Iain Buclaw wrote:
>
> On the note of if statements. One pattern of bugs I see on the odd occasion are
> else statements written like this:
>
> if (condition1)
>      if (condition2)
>          statement1;
>      else
>          statement2;
>
>
> Always takes a moment or two to look again and realise it wouldn't work as
> expected without the missing braces added. ;)

But that one would actually work as expected, wouldn't it? ;) The else 
belongs to the second if, which matches your indentation.


More information about the Digitalmars-d mailing list