THE META-HTML LANGUAGE REFERENCE MANUAL

Dynamic Modules [TOC] Csv Module

Section Intro: Elsewhen Module

Elsewhen Module

Synopsis:

    This module is provided for those programmers who feel more comfortable with a balanced tag syntax for flow control over a balanced brace syntax. Using the tags in this package will greatly reduce the number of group, or concat tags, at the slight cost of interpreter speed. In many cases, the clarity of the code is more important, so if you are one of those programmers that feel more comfortable with the tag-based syntax, you might consider the use of this module.

Commands:

<cif TEST &optional [THEN-CLAUSE] [] [ELSE-CLAUSE]
  body
</cif>
Complex

    First TEST is evaluated. If the result is a non-whitespace only string, the statements between the THEN-CLAUSE and the ELSE-CLAUSE are evaluated. Otherwise, if the the ELSE-CLAUSE is present, it is evaluated. Although Meta-HTML has an or function, you can efficiently test for the presence of any of a group of variables with code similar to the following:

    <if <get-var foo bar>>
      "Either FOO or BAR is present"
    <else>
      "Neither FOO nor BAR is present"
    </if>

<whenelse TEST
  body
</whenelse>
Complex

    Evaluate TEST. If the result is a non-empty string, then execute the BODY statements. If the tag <elsewhen> appears in the body, then the commands between that tag and the closing </whenelse> will be executed if, and only if, the TEST evaluates to the empty string. This is a cleaner way to handle optional multiple statement execution rather than dealing with quoting everything inside of an if form.

Edit Section
Function Index
Variable Index


The META-HTML Reference Manual V2.0 Copyright © 1995, 1998, Brian J. Fox
Found a bug? Send mail to bug-manual@metahtml.org