-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
Add switch expression syntax #586
Comments
I have nothing against having a switch statement, but ClickHouse also has multiIf function with short-circuit-function-evaluation. It is often more readable than a switch and addresses your concerns about "evaluate all conditions and cases before choosing a correct one". |
While switch statement is easy to understand and implement, maybe we need to consider adding "match" expression instead. Or to make expr closer to golang and implement switch in the exact same semantics. |
I very much would like to see multi-line expressions happen, so it would make sense to have switches to be an expression as well, e.g. in Ruby:
The key point is that it evaluates to an expression. The syntax does not matter. |
I see. This makes sense. 👍🏻 |
But implementing it as function not the best solution. As it will require to evaluate all conditions and cases before choosing a correct one.
We need to create a proper switch syntax in Expr.
Originally posted by @antonmedv in #579 (comment)
The text was updated successfully, but these errors were encountered: