Patterns of Bugs
Daniel Gibson
metalcaedes at gmail.com
Sat Jan 8 12:55:19 PST 2011
Am 08.01.2011 21:53, schrieb Iain Buclaw:
> == 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
(D1 code):
import std.stdio;
void main(string[] args) {
if(args.length > 1)
if(args.length > 2)
writefln("foo");
else
writefln("bar");
}
caedes at Mancubus:/tmp $ ./test
caedes at Mancubus:/tmp $ ./test a
bar
caedes at Mancubus:/tmp $ ./test a b
foo
More information about the Digitalmars-d
mailing list