Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I understand inline if as:
`if (something) doSomething();`
And ternary as:
`return cool ? "Cool" : "Not cool";`
Or are the names interchangeable?
🤔 -
@BellAppLab i wasnt aware people called ?: ternary, i guess the names are interchangable
-
I'm su bad at ternary operators. It's not inherently obvious whether the true statement goes first or the false one.
-
Trying to understand inline lambdas in C++ is worse and you might end up shooting yourself
-
@bdhobare we have them as function arguments in our source code. I think that they suck for different reasons, though. They're rare enough that I just Google the syntax for a refresher if I need it.
-
zshh38538yIf not abused, it makes the code more readable in my opinion. What you should never do is to nest ternary operations, THAT is confusing.
Confession: i hate inline ifs and i cant even spot them in the code.
undefined