-
Notifications
You must be signed in to change notification settings - Fork 46
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
Conditional Expression without else #102
Comments
will this work? |
@Namek yes |
+1. Will it still work if |
I have rarely ever though I would want something like this, ternary expressions never felt wrong. But when I have more than one condition the ternary mode can become a mess. This is not the best example in the world but it illustrates my point. var size = useLarge ? "large" : useSmall ? "small" : "medium"; rewritten with the proposed form var size = "large" if useLarge else "small" if useSmall else "medium"; formats nicely too var size = "large" if useLarge else
"small" if useSmall else
"medium"; |
+1 |
compiles to:
which compiles to:
The text was updated successfully, but these errors were encountered: