4 ms·
Assignable return values: +1 Concise AND expressions (eg "case UP, DOWN -> 1;"): +1 Using keyword 'break' instead of 'return': -1
by specialist 9y ago
Assignable return values: +1
Concise AND expressions (eg "case UP, DOWN -> 1;"): +1
Using keyword 'break' instead of 'return': -1
- tzahola 9y agoYou mean concise OR expressions, right?
- specialist 9y agoI’m not sure. Reading the JEP, I inferred the separate clauses were the ORs and each clause’s compound expression could have ANDs. But what you say is likely right.
- mikelward 9y ago'break' feels ugly, but doesn't 'return' already have a different meaning here? You could do something context sensitive to make 'return' act differently in a switch expression versus a switch statement, but that seems more confusing.
- earenndil 9y ago> You could do something context sensitive to make 'return' act differently in a switch expression versus a switch statement But you shouldn't. That would break existing code. What if you actually want to return something from within a switch statement?
- mikelward 9y agoYou ignored the parts where I said "already has a different meaning" and "that seems more confusing".