| ▲ | 3eb7988a1663 2 hours ago | ||||||||||||||||||||||
Never will I understand ternary operators. As soon as you introduce it, some chuckle heads want to use them everywhere. Worse if the syntax allows nested ternarys. I guess it keeps the language open for code golfing, but it otherwise seems like redundant syntax that at best saves a few characters. | |||||||||||||||||||||||
| ▲ | 201984 2 hours ago | parent | next [-] | ||||||||||||||||||||||
Lua basically already has ternary operators anyway since "and" and "or" short circuit. I also don't see the need of adding additional syntax for it. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | demilicious 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
That’s why “if” should just be an expression | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | hiccuphippo 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
I find it most useful in languages that have non-mutable variables and you want to avoid a mutable variable or an extra function when the value comes from a simple condition. | |||||||||||||||||||||||
| ▲ | Gualdrapo 2 hours ago | parent | prev [-] | ||||||||||||||||||||||
I guess for the JS case it makes sense to be able to shave a few characters for file shrinking purposes, but generally I'm more biased to code clarity and "self-explainability" | |||||||||||||||||||||||
| |||||||||||||||||||||||