Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^6: if/else syntax

by gwadej (Chaplain)
on Jun 29, 2009 at 13:34 UTC ( #775668=note: print w/ replies, xml ) Need Help??


in reply to Re^5: if/else syntax
in thread if/else syntax

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


Comment on Re^6: if/else syntax
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://775668]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2015-07-03 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls