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

    else

    Syntax

    if (expression) {
            /* code */
    }
    else {
        /* code */
    }

    Release Information

    Statement introduced in version 1.0 of the SLAX language.

    Description

    Include a default set of instructions that are processed if the preceding if and else if statements evaluate to FALSE.

    SLAX Example

    if (starts-with(name, "fe-")) {
        if (mtu < 1500) {
            /* Select the Fast Ethernet interfaces with low MTUs */
        }
    }
    else {
        if (mtu > 8096) {
            /* Select the non-Fast Ethernet interfaces with high MTUs */
        }
    }

    XSLT Equivalent

    <xsl:choose>
        <xsl:when select="starts-with(name, 'fe-')">
            <xsl:if test="mtu &lt; 1500">
                <!-- Select with Fast Ethernet interfaces with low MTUs -->
            </xsl:if>
        </xsl:when>
        <xsl:otherwise>
            <xsl:if test="mtu &gt; 8096">
                <!-- Select the non-Fast Ethernet interfaces with high MTUs -->
            </xsl:if>
        </xsl:otherwise>
    </xsl:choose>

    Usage Examples

    See Example: Configuring Dual Routing Engines and Example: Automatically Configuring Logical Interfaces and IP Addresses.

    Published: 2013-03-05