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 operator in one line #25

Closed
gittycat opened this issue Jun 22, 2014 · 2 comments
Closed

Ternary operator in one line #25

gittycat opened this issue Jun 22, 2014 · 2 comments

Comments

@gittycat
Copy link

The whole point of the ternary operator ( var foo = condition ? val1 : val2) is to be succinct. In every language where it is used it is expressed in one line, otherwise the if/then/else makes more sense. This has been the case for at least 20 years.

What is the justification for recommending that ? and : be on separate lines?

@kentcdodds
Copy link
Contributor

See #19. In short, I agree with you...

@felixge
Copy link
Owner

felixge commented Jun 22, 2014

@gittycat the multiline ternary operator is still superior/different to if/then/else by allowing you to avoid duplicating a return or assignment statement. I understand that this is not everybody's cup of tea, that's why the README of this project clearly states that this is based on personal opinions and "You are encouraged to fork this repository and make adjustments according to your preferences.".

@felixge felixge closed this as completed Jun 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants