Notes IV

Jesse Phillips jessekphillips at gmail.com
Fri Jan 25 16:24:34 PST 2008


On Fri, 25 Jan 2008 09:26:13 -0500, bearophile wrote:

> Oskar Linde:
>> A working compromise would be to disallow only "ambiguous" else
>> clauses, forcing one to add {} in those cases only.
> 
> I like this idea, can you show few examples? If it's a good compromise
> then it may be used in D 2.x...
> 
> Bye,
> bearophile

Well what I would think is:

if(true)
    if(false)
        a()
    else
        b()

This would not be allowed, that is to say an if statement with a 
corresponding else must use braces:

if(true)
    if(false) {
        a()
    } else
        b()

In any case I like this idea and will now be using it for my own coding 
style.



More information about the Digitalmars-d mailing list