4

!rant
When I discovered the usage of (statement) ? : after two years in programming school, I feel like an explorer landing on a new continent.
It looks so much more like the cool hacker code from television. I can use it as a parameter for function calls.. and everywhere else.

But it makes my code unreadable.

But it's new and fancy.

But unreadable..

What should I do?

Comments
  • 1
    Sometimes it's really useful. But don't use it if it gets too long. It really depends in my opinion.
  • 1
    Depends on the case. When it's short enough go for it, if it gives you a super long oneliner I prefer not to.
  • 0
    I love the ternary operator for its simplicity, it really is useful in those occasions where something is so simple an if else block would be overkill.

    Unfortunately our coding standard forbids it's use.
Add Comment