The best I can come up with is this:
ANIMAL: if (isAnimal) {
DOG: if (isDog) {
POODLE: if (isPoodle) {
if (color == green) {
break POODLE; // we don't want green poodles
}
if (age > 10) {
break DOG; // we don't want old dogs
}
if (weight > 20) {
break ANIMAL; // we don't want heavy animals
}
// more poodle conditions
}
// more dog conditions
}
// more animal conditions
}Several languages support labels with "break" and "continue". It's mostly useful to break out several layers at once (nested loops, etc).
See for example Java: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/bra...
Do you have any idea if it was intended to be used as you describe ?