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

Re^2: looking for a good idiom: return this if this is true

by DentArthurDent (Monk)
on Mar 07, 2005 at 17:58 UTC ( #437274=note: print w/ replies, xml ) Need Help??


in reply to Re: looking for a good idiom: return this if this is true
in thread looking for a good idiom: return this if this is true

Doesn't the following bit of code work? It's only slightly more obtuse than what you propose.
thatroutine() and return 1;
UPDATE: I just tested this to prevent ignorance, and it does in fact work.
UPDATE AGAIN: Ah, I missed the point. My code does not return the value returned by thatroutine(). If there are no side effects I suppose you could do:
thatroutine() and return thatroutine();
:-)
----
My mission: To boldy split infinitives that have never been split before!


Comment on Re^2: looking for a good idiom: return this if this is true
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (17)
As of 2015-07-29 20:23 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 (268 votes), past polls