Simple Switch With Break
suggest changeThe break
keyword can be used in switch statements to exit the statement before evaluating all conditions.
Example:
switch('Condition')
{
'Condition'
{
'First Action'
}
'Condition'
{
'Second Action'
break
}
'Condition'
{
'Third Action'
}
}
Output:
First Action
Second Action
Because of the break
keyword in the second action, the third condition is not evaluated.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents