Should we support a switch with several arguments ?

By example:
  for(int i = 1; i < 100; i++) {
    System.out.println(
      switch(i % 3, i % 5) {
        case (0, 0) -> "FizzBuzz";
        case (0, _) -> "Fizz";
        case (_, 0) -> "Buzz";
        default -> i;
      });
  }

Apart FizzBuzz, it's very convenient when you want to merge things, take 
decision depending on more than one value.

Note that this example also use the "locals do not need to be effectively 
final" semantics.

Rémi

Reply via email to