| ▲ | Heliodex 2 hours ago | |||||||||||||||||||||||||
A comment <https://github.com/LuaJIT/LuaJIT/issues/1475#issuecomment-47...> has already been made on the issue regarding the ternary operator, recommending `if x then y else z` over `x ? y : z`. This is exactly how it's done with if-then-else expressions in Luau <https://luau.org/syntax/#if-then-else-expressions>, another language compatible with Lua, and makes it a ton easier to nest (especially with elseif) and I believe still easier to read than `y if x else z`. | ||||||||||||||||||||||||||
| ▲ | mjcohen 2 hours ago | parent [-] | |||||||||||||||||||||||||
The ternary operator is easy to nest if you put each clause on a separate line. Then it looks just like nested if-then-else. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||