I think in many cases the pants don’t fit. Men wear generally sucks in my experience. Some time ago I got a pair of shorts with a good fit and I was amazed that I didn’t need a belt.
There’s a paragraph about waist height in this article: https://www.ft.com/content/e7956680-b399-4e26-9455-741c7c1b3441
I agree you should use a switch where applicable, but ternaries are the expression equivalent of if-else statements. If I have two conditions and a default, and each branch simply evaluates to a value of the same type, I’ll probably just use a ternary.
Yes, you need to read code to understand it. If else statements can also do the job of a switch, so the exact same argument applies.
PHP is the only language in existence with a left associative ternary operator. Ignoring PHP, the operator has worked exactly the same way for decades. And even PHP has now fixed the operator.
I don’t think it’s reasonable to avoid a very commonly supported pattern just because a single badly designed language implemented it wrong.
How is it unsafe?
In the given example I’d probably use a switch / match expression, but ternaries are usually more flexible than switches and I don’t think it’s an issue to write a nested ternary instead of if else statements.
Don’t support inbreeding, get a mutt.
Ternary expressions aren’t switches though
Why?
It’s perfectly readable.
Disco Elysium
Communism may not be built in a day, but 0.0001% completion is still progress!
I’ve made you aware that claiming the word “nazi” doesn’t mean anything anymore is a thing nazis do.
Do with that what you will.
Maybe don’t parrot nazi talking points then
I have this theory that people who complain about everyone being called nazis, have themselves been called a nazi.
Why do people call you a nazi, hmm?
We still have more jokes than anarchy chess, though
Vacuum doesn’t suck. The atmosphere on Earth would push air through the portal with a pressure of about 1 bar.