Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ternary branch text seems too strong #686

Open
pochmann opened this issue Dec 3, 2017 · 1 comment
Open

Ternary branch text seems too strong #686

pochmann opened this issue Dec 3, 2017 · 1 comment

Comments

@pochmann
Copy link

pochmann commented Dec 3, 2017

It says:

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.

@pochmann pochmann changed the title Nested ternary text seems too strong Ternary branch text seems too strong Dec 3, 2017
@bbatsov
Copy link
Collaborator

bbatsov commented Jun 12, 2019

Not intended. The point was avoid sequential expressions (e.g. foo; bar). The language should definitely be improved here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants