Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    set

    Syntax

    set $name = value;

    Release Information

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

    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.

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

    Published: 2013-03-05