[j-nsp] break statement in SLAX

Phil Shafer phil at juniper.net
Fri Dec 14 14:42:32 EST 2018


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


More information about the juniper-nsp mailing list