switch ?options? string pattern body ?pattern body ...?
switch ?options? string {pattern body ?pattern body ...?}
If the initial arguments to switch start with - then they are treated as options. The following options are currently supported:
switch abc a - b {format 1} abc {format 2} default {format 3}
will return 2, switch -regexp aaab {
^a.*b$ -
b {format 1}
a* {format 2}
default {format 3}
}
will return 1, andswitch xyz {
a
-
b
{format 1}
a*
{format 2}
default
{format 3}
}
will return 3.
Copyright © 1989-1994 The Regents of the University of California.
Copyright © 1994-1997 Sun Microsystems, Inc.