AlmightySnoo 🐢🇮🇱🇺🇦@lemmy.world to Programmer Humor@lemmy.ml · edit-21 year agoand people wonder why we say PHP is a memelemmy.worldimagemessage-square16fedilinkarrow-up16arrow-down12
arrow-up14arrow-down1imageand people wonder why we say PHP is a memelemmy.worldAlmightySnoo 🐢🇮🇱🇺🇦@lemmy.world to Programmer Humor@lemmy.ml · edit-21 year agomessage-square16fedilink
minus-squarekibiz0r@lemmy.worldlinkfedilinkarrow-up7·1 year agoTo be fair: If you are chaining ternary expressions, you deserve to suffer whatever pain the language happens to inflict upon you tenfold.
minus-squarelowleveldata@programming.devlinkfedilinkarrow-up3arrow-down2·1 year agoIt is sort of readable. A switch is “perfectly” readable for switching.
minus-squareSerdan@lemm.eelinkfedilinkarrow-up0arrow-down1·1 year agoTernary expressions aren’t switches though
minus-squareKryomaani@sopuli.xyzlinkfedilinkEnglisharrow-up1·1 year agoWhich is exactly why you shouldn’t be using them in a situation that clearly calls for a switch.
To be fair: If you are chaining ternary expressions, you deserve to suffer whatever pain the language happens to inflict upon you tenfold.
Why?
It’s perfectly readable.
It is sort of readable. A switch is “perfectly” readable for switching.
Ternary expressions aren’t switches though
Which is exactly why you shouldn’t be using them in a situation that clearly calls for a switch.