Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Automation Scripting User Guide
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

set

date_range 13-Jan-21

Syntax

content_copy zoom_out_map
set $name = value;

Description

Assign a value to a mutable variable. The variable must be defined using the mvar statement.

Attributes

name

Name of the mutable variable.

value

Value to assign to the mutable variable.

SLAX Example

The following example creates the mutable variable, block. The set statement assigns an initial value to the block variable. In the for loop, the code iterates over each item in the specified list and appends an <item> element with two child elements, <name> and <size>, to the node set stored in the block variable.

content_copy zoom_out_map
mvar $block;
set $block = <block> "item list";

for $item (list) {
    append $block += <item> {
        <name> $item/name;
        <size> $item/size;
    }
}

Release Information

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

footer-navigation