I appreciate your views. I was resistant to the ternary operator as well when I first started learning to program in PHP. It was not intuitive and I’d rather write an if/else.

However, I think there’s a difference between learning the ternary operator as a new programmer and trying to adopt it after long periods of being used to if/else.

Clarity is an odd thing that way, you’ll inevitably be conditioned to some code being easier to read than others based on your experiences.

Regardless, your opinion is important and shared by others. Thanks for sharing it with me and the rest of the community.

Written by

Top writer with 1M+ views. Follow me at and

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store