March 2019
Intermediate to advanced
242 pages
6h 21m
English
You can use labels and a continue statement within switch expressions. However, you can't jump through switch expressions by using them as follows. Here's an example:
class Planet {
private static long damage;
public void use(SingleUsePlastic plastic) {
myLabel: // Label
for (...) {
damage += switch(plastic) {
case SPOON, FORK, KNIFE : break 7;
case PLATE : continue myLabel; // NOT // allowed
// illegal // jump
// through // switch
// expression
};
}
}
}
Read now
Unlock full access