You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use one expression per branch in a ternary operator. This also means that ternary operators must not be nested.
So apparently you're counting subexpressions and thus these are considered bad:
i ? t + 1 : e # Three expressions in true-branch: t, 1 and t + 1
i ? f(t) : e # Two expressions in true-branch: t and f(t)
x < 0 ? -x : x # Two expressions in true-branch: x and -x
Is that really intended? If so, I think it would be good to include them as "bad" examples. If not, then I think the wording should be improved.
The text was updated successfully, but these errors were encountered:
pochmann
changed the title
Nested ternary text seems too strong
Ternary branch text seems too strong
Dec 3, 2017
It says:
So apparently you're counting subexpressions and thus these are considered bad:
Is that really intended? If so, I think it would be good to include them as "bad" examples. If not, then I think the wording should be improved.
The text was updated successfully, but these errors were encountered: