That functionality is already inherent in the semantics of if {..} elseif {...}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
if(someCondition)
{
//this gets executed if someCondition is true.
//the else if {} and the else {} do not get executed
}
elseif(anotherCondition)
{
//this gets executed if someCondition is false
//and if anotherCondition is true. The else {}
//does not get executed
}
else
{
//this gets executed if both someCondition and
//anotherCondtion are false
}
break; actually causes execution to jump out of the loop entirely.