Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Perl 5.10: switch statement demo

by ikegami (Patriarch)
on Dec 19, 2007 at 22:48 UTC ( [id://657994]=note: print w/replies, xml ) Need Help??


in reply to Perl 5.10: switch statement demo

Judging by how often people forget to place break;, it's much more natural for us to think of cases as exclusive. Or maybe it's because it's much more common to want exclusive cases, in which case it also saves us needless typing.

Replies are listed 'Best First'.
Re^2: Perl 5.10: switch statement demo
by talexb (Chancellor) on Dec 20, 2007 at 15:29 UTC
      Judging by how often people forget to place break;, it's much more natural for us to think of cases as exclusive.

    I dunno -- remembering to add the break; is just one of the things that I know and will never forget when I write C. You can call it a feature or a bug, but it's part of the language that I know.

    I didn't write the node to complain, really, it's more of a warning for anyone else who grew up writing C. And it's spawned a couple of really good responses detailing alternative approaches that work, both before and after 5.10. And that discussion, by itself, is very useful.

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-23 17:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found