Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Ternary operators: a hinderance, not a help

by Koolstylez (Scribe)
on Aug 10, 2005 at 17:50 UTC ( [id://482676]=note: print w/replies, xml ) Need Help??


in reply to Ternary operators: a hinderance, not a help

I talked with a couple of colleagues about this, and found that opinion seems to be divided one way or the other: either you love boolean ? value_if_true : value_if_false, or you hate it.

I think it's a bad idea to love an operator. They always end up leaving you for a younger and better looking programmer ;)

Seriously though, loving or hating an operator isn't a good idea. Most of the constructs a programming language like Perl offers you can be abused to produce nearly unreadable code (see Obfuscation). It's up to the programmer to write maintainable code, and _sometimes_ the ternary operator can make your code more readable.
  • Comment on Re: Ternary operators: a hinderance, not a help

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-19 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found