Omni Systems, Inc. Mif2Go User's Guide, Version 55
> 28 Working with macros > 28.4 Using multiple-value list variables > 28.4.6 Using a list instead of a conditional expression
Suppose you want a different navigation bar for some of your HTML output files, depending on the name of the chapter from which the files are generated. One way would be to use a conditional expression (see §28.6.4.2 Using conditional expressions) to check the current chapter file name and choose the code for the navigation bar. For example:
; Configure navigation bar for roadmap:
<$_if ($$_currbase is "user_roadmap")> <$rmap>
; Configure navigation bar for Programmer's Guide topics:
<$_elseif ($$_currbase is "bgp_user")> <$pgnav>
<$_elseif ($$_currbase is "mld_user")> <$pgnav>
... (long list of similar clauses)
<$_elseif ($$_currbase is "pga_user")> <$pgnav>
; Configure navigation bar for function topics, by default:
<a href="functions.htm">Function Index</a>
Instead, you could use a list indexed by the
value of $$_currbase
, with each list value
a macro call (or HTML code):
0 = <p><a href="functions.htm">Function Index</a></p>
The 0
(zero) list item
corresponds to the <$_else>
clause in
the original [NavBar]
macro, and is used if
the specified index (the value of $$_currbase
)
is not found. Instead of a macro call the value of this list item is
straight HTML code, which works as long as the code is all on one line.
You could just as well use a macro call for the zero value, like the
rest of the list items.