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

Simplify CASE #2

Open
ranma42 opened this issue Dec 28, 2024 · 0 comments
Open

Simplify CASE #2

ranma42 opened this issue Dec 28, 2024 · 0 comments

Comments

@ranma42
Copy link
Owner

ranma42 commented Dec 28, 2024

The expressions are equivalent (the arrow describes the preferred direction):

CASE
  WHEN t1 THEN r1
  ELSE CASE
    WHEN t2 THEN r2
    ELSE r3
  END
END

CASE
  WHEN t1 THEN r1
  WHEN t2 THEN r2
  ELSE r3
END

To keep the following expressions simpler, they are given using ternary notation, i.e. t1 ? r1 : r2 instead of CASE WHEN t1 THEN r1 ELSE r2 END.

[ ] t ? x : xx
[x] (t ? true : false/null) ? r1 : r2)t ? r1 : r2 dotnet#34175
[x] (t ? false/null : true) ? r1 : r2)!t ? r1 : r2 dotnet#34175
[ ] t ? true : falset == true
[ ] t ? false : true!boolExpr
[ ] !boolExpr ? x : yboolExpr ? y : x
[ ] !(t ? x : y)t ? !x : !y

WIP

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

1 participant