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

Some sort of match operator? #3

Open
scizzorz opened this issue May 3, 2018 · 0 comments
Open

Some sort of match operator? #3

scizzorz opened this issue May 3, 2018 · 0 comments
Labels
lang Language improvement proposals
Milestone

Comments

@scizzorz
Copy link
Owner

scizzorz commented May 3, 2018

Rust's match blocks have some neato features, like range matching and stuff. Is there a way to make an operator that can work like that?

~Rust:

match x {
  0 => ...
  1..9 => ...
  10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 => ...
  _ => ...
}

Python:

if x == 0: ...
elif 1 <= x <= 9: ...
elif x in (10, 20, 30, 40, 50, 60, 70, 80, 90): ...
else: ...

Mask:

if x ? 0: ...
elif x ? 1..9: ...
elif x ? [10, 20, 30, 40, 50, 60, 70, 80, 90]: ...

DUNNO.

@scizzorz scizzorz added the lang Language improvement proposals label May 3, 2018
@scizzorz scizzorz added this to the X milestone May 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang Language improvement proposals
Projects
None yet
Development

No branches or pull requests

1 participant