Switch, Case, and Default Tags

The switch, case, and default tags provide conditional branching that is similar to the switch, case, and default statements in the C++ language. For example, they can use the following format:

<div od-switch>
  <div od-case condition="case_tag_attribute">
    ...
  </div od-case>
  <div od-case condition="case_tag_attribute">
    ...
  <!--od section case close–>
  <div od-default>
    ...
 </!--od section default close–>
<!--od section switch close–>

where:

  • condition. Is an attribute of the case tag that specifies the condition that SWE examines. The condition attribute uses the same format that the if tag uses. If any case tag:

    • Satisfies the condition. SWE ignores all subsequent case tags and default tags. It processes the body of the if tag.

    • Does not satisfy the condition. SWE processes the body of the default tag.

    For more information, see If Tag.

Note the following:

  • The switch tag is a container tag that SWE uses for the case and default tags. SWE ignores any other type of tag that the body of the switch tag contains.

  • SWE examines the case tags starting with the first case tag it encounters.

  • SWE allows only one default tag in the body of a switch tag.