5

✔||🤢 Commit or Vomit | nested conditional operator

 3 years ago
source link: https://dev.to/jmdejager/commit-or-vomit-nested-ternary-operator-1d02
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

The conditional operator

It's a delight to use them but should we use them as much as possible? what do you think about the next example? ✔||🤢

H = (C == 0 ? null :
    V == r ? (g - b) / C :
    V == g ? (b - r) / C + 2 :
             (r - g) / C + 4
    );
Enter fullscreen modeExit fullscreen mode

nested conditional operators ✔||🤢?

❤: Commit (I'd commit something like this)
🏷: Vomit (we all know unicorns don't vomit)
🦄: Like your post please continue this series!

Let's vote! 😊

Photo by Science in HD on Unsplash


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK