CodeX
Published in

CodeX

Replacing Ternary Operators With the Elvis Operator

Because Elvis is the king of rock and roll

In computer programming, if statements are among the most used control statements. They are found in virtually every programming language, and it’s not too uncommon to end up nesting them in one way or another.

$elvis = true;
$ballad = true;

--

--

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