Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

while

Syntax

Description

Repeatedly execute a block of statements until the specified condition evaluates to false. The condition is an XPath expression that is converted to a boolean type. If the expression evaluates to true, the contents of the while loop are executed. The loop continues to execute until the expression evaluates to false. During execution, the context is not changed. In the expression, you should use a mutable variable, which is declared using the mvar statement, to avoid creating an infinite loop.

Attributes

expression

XPath expression, which is cast to boolean type and used as the condition for the while loop. The code block contents are executed as long as the condition evaluates to true.

SLAX Example

In the example, the while loop parses through the item list until the desired value is found. When that value is detected, $seen is set to true, and the while loop exits.

Release Information

Statement introduced in version 1.1 of the SLAX language, which is supported in Junos OS Release 12.2 and later releases.