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

Can we expect 'switch' operator rework? #745

Open
woozbooz opened this issue Dec 15, 2019 · 1 comment
Open

Can we expect 'switch' operator rework? #745

woozbooz opened this issue Dec 15, 2019 · 1 comment
Labels
request Requests to resolve a particular developer problem

Comments

@woozbooz
Copy link

I hope Dart devs will add range of values and range checking in switch/case operators - check if value is in range, check array elements, check multiple variables with same switch operator.

For example:

int i=27;
switch (i) {
    case 1..30:
    break;
    default:
}

List<int> a=[1,5,7,14,25,30];
switch (a) {
  case a.contains(5):
  break;
  case a[1..4]>0:
  break;
}

switch ([a,i] /*(or just a,i)*/ ) {
  case i==5:
  case a[1..4]>0:
  break;
  case a[i] !=0:
  break;
}
@woozbooz woozbooz added the feature Proposed language feature that solves one or more problems label Dec 15, 2019
@charafau
Copy link

it probably will, with pattern matching

@mit-mit mit-mit added request Requests to resolve a particular developer problem and removed feature Proposed language feature that solves one or more problems labels Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request Requests to resolve a particular developer problem
Projects
None yet
Development

No branches or pull requests

3 participants