The break statement
Syntax
break
The break
statement is used to exit an enclosing
foreach loop or a
case statement. The break
statement cannot
be used in any other location.
In this example, a break
is used to exit a
foreach loop when a particular condition
matches.
Example of break within foreach
foreach i (Class) {
if (i == 0xabcdef) {
break
}
reply += {
Reply-Message = "Contains %{i}"
}
}
In the next example, a break
is used to exit a
case statement, which then also exits the
parent switch statement
Example of break within case / switch
switch User-Name {
case 'bob' {
if (NAS-IP-Address == 192.0.2.1) {
break
}
reject
}
default {
ok
}
}