else
Syntax
if (expression) { /* code */ } else { /* code */ }
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 < 1500"> <!-- Select with Fast Ethernet interfaces with low MTUs --> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:if test="mtu > 8096"> <!-- Select the non-Fast Ethernet interfaces with high MTUs --> </xsl:if> </xsl:otherwise> </xsl:choose>
Usage Examples
See Example: Configure Dual Routing Engines and Example: Automatically Configure Logical Interfaces and IP Addresses.
Release Information
Statement introduced in version 1.0 of the SLAX language.