Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

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

else if

date_range 10-Feb-21

Syntax

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

Description

Include instructions that are processed if the expression defined in the preceding if statement evaluates to FALSE and the expression defined in the else if statement evaluates to TRUE. Multiple else if statements can be included, but the processor only executes the instructions contained in the first else if statement whose expression evaluates to TRUE. All subsequent else if statements are ignored.

SLAX Example

content_copy zoom_out_map
var $description2 = {
   if (description) {
      expr description;
   }
   else if (../description) {
      expr ../description; 
   }
   else {
      expr "no description found";
   }
}

XSLT Equivalent

content_copy zoom_out_map
<xsl:variable name="description2">
   <xsl:choose>
      <xsl:when test="description">
         <xsl:value-of select="description"/>
      </xsl:when>
      <xsl:when test="../description">
         <xsl:value-of select="../description"/>
      </xsl:when>
      <xsl:otherwise>unknown</xsl:otherwise>
   </xsl:choose>
</xsl:variable>

Release Information

Statement introduced in version 1.0 of the SLAX language.

footer-navigation