Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: "return" to break out of a loop

by phaylon (Curate)
on May 13, 2008 at 18:49 UTC ( #686344=note: print w/ replies, xml ) Need Help??


in reply to Re: "return" to break out of a loop
in thread "return" to break out of a loop

For this to _really_ be nice, stuff like if would have to return the last value of the executed block:

sub is_even { if (shift % 2) { 0 } else { 1 } }
We already have the ternary operator, but I find it can get hard to maintain when used often in one statement. Sparkling some do { .. }'s in only makes it a bit better.

Ordinary morality is for ordinary people. -- Aleister Crowley


Comment on Re^2: "return" to break out of a loop
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2015-07-08 04:46 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 (94 votes), past polls