Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'd suggest you check your standard again. It was defined in K&R and in the ANSI/ISO standard. Update: Just to make sure I hadn't misremembered, I dug out the ISO C++ standard (which is all I have handy at the moment.) Section 6.4.1 addresses this issue. In the second form of if statement (the one including else), if the first substatement is also an if statement then that inner if statement shall contain an else part. There was also no contradiction in my later statement. The is no ambiguity in the standard (or compiler) interpretation. But there is a problem with the way the programmer will read it. This is why Perl made the braces mandatory and Python made the indention mandatory.
G. Wade
In reply to Re^6: if/else syntax
by gwadej
|
|