Patterns of Bugs
Lars T. Kyllingstad
public at kyllingen.NOSPAMnet
Mon Jan 10 00:11:51 PST 2011
On Sat, 08 Jan 2011 20:53:20 +0000, Iain Buclaw wrote:
> == Quote from Ellery Newcomer (ellery-newcomer at utulsa.edu)'s article
>> On 01/08/2011 02:37 PM, Iain Buclaw wrote:
>> >
>> > Never let indentation fool you, the else clause will be assumed to be
>> > for the first condition. :o)
>> I don't believe you
>
> Are you saying it *isn't* interpreted as:
>
> if (i)
> if (j)
> printf("J true\n");
> else
> printf("I false\n");
>
>
> :o
>From the grammar:
"The 'dangling else' parsing problem is solved by associating the else
with the nearest if statement."
http://www.digitalmars.com/d/2.0/statement.html#IfStatement
-Lars
More information about the Digitalmars-d
mailing list