[j-nsp] break statement in SLAX
Martin T
m4rtntns at gmail.com
Mon Dec 17 02:45:32 EST 2018
On Fri, Dec 14, 2018 at 9:41 PM Phil Shafer <phil at juniper.net> wrote:
>
> Martin T writes:
> >> Now I want to process only the first three integers which are less
> >> than 5. As I understand, for-each loop does not support breaking out
> >> from the loop so I did it like this:
>
> Yes, for-each lacks a break, but while can help.
>
> >In addition, it would require a protection against an endless loop
> >inside the while loop. Something like this:
> >
> >if ( $n > count($int_ns) ) {
> > set $m = 4;
> >}
>
> You can hang inside a while loop forever. While that's not it's
> goal, it's occasionally useful.
>
> Thanks,
> Phil
Thanks Phil!
Martin
More information about the juniper-nsp
mailing list