good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^4: if/else syntaxby gwadej (Chaplain) |
on Jun 26, 2009 at 16:44 UTC ( [id://775104]=note: print w/replies, xml ) | Need Help?? |
There's actually no ambiguity in the C syntax for your example. The compiler understands it fine. The problem is that the programmer/reader of the code does not always read it the same way.
According to what I recall, the else matches with the nearest if in this case. Unfortunately, indentation gives humans fits on this.
This does the same thing (else goes with if(b)). As I said, there's nothing ambiguous about it.
G. Wade
In Section
Seekers of Perl Wisdom
|
|