Making it compile

Report a typo

Why won't the following code compile?

int howHungryAmI = 0; // 1 is stuffed, 10 is starving

int numberOfHamburgersToEat = switch (howHungryAmI) {
    case 1, 2, 3 -> 0;
    case 4, 5, 6 -> 1;
    case 7, 8, 9 -> 2;
    case 10 -> 3;
};
Select one option from the list
___

Create a free account to access the full topic