Thank you for stopping by! I am a full-stack developer that combines the power of entrepreneurship and programming to make the lives of programmers easier.
It could be that calling it an operator is simply confusing.
Coffeescript has a
if(b<5)thenbelse5
Which makes it look more like an inline if that returns its values from the if or else block.
So, the conditional operator would be more like:
leta=(function(){if(b<5)returnb;elsereturn5;})();
I really like the solution though, it makes so much more sense to have it be made up of binary operators now. It doesn't even make sense to add the conditional operator back in since the ? and | are already fully encompassing its use cases.
I really dislike the inline if ... else forms that some languages have, also including Python. It looks really messy, and more like a flow statement than an expression.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It could be that calling it an operator is simply confusing.
Coffeescript has a
Which makes it look more like an inline if that returns its values from the
if
orelse
block.So, the conditional operator would be more like:
I really like the solution though, it makes so much more sense to have it be made up of binary operators now. It doesn't even make sense to add the conditional operator back in since the
?
and|
are already fully encompassing its use cases.I really dislike the inline
if ... else
forms that some languages have, also including Python. It looks really messy, and more like a flow statement than an expression.