Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: in search of a more elegant if then else

by aaron.m (Novice)
on Feb 19, 2010 at 00:17 UTC ( [id://824071]=note: print w/replies, xml ) Need Help??


in reply to Re: in search of a more elegant if then else
in thread in search of a more elegant if then else

If it "fits," and is easy to read, use the ternary. Otherwise, use the if-then. Think in terms of which one will be easier to understand when someone else - ie. your boss - will be looking over your shoulder while you try to figure out a bug in something you wrote $x months or years ago.

Be kind to yourself.

Replies are listed 'Best First'.
Re^3: in search of a more elegant if then else
by zebedee (Pilgrim) on Feb 19, 2010 at 09:07 UTC
    I go for the Friday 4 p.m. test. It's broken, it's 4 p.m. on Friday, you've had a LOOONGGG week, and you want to think about going home.

    Which one is going to be easier to read and fix?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-28 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found