diff options
author | rjohnson <rjohnson@noemail.net> | 1998-03-26 14:45:59 (GMT) |
---|---|---|
committer | rjohnson <rjohnson@noemail.net> | 1998-03-26 14:45:59 (GMT) |
commit | 26a76b6c669bbb7629454ffa56a7f3f501a86dae (patch) | |
tree | 6e8c9473978f6dab66c601e911721a7bd9d70b1b /doc/case.n | |
parent | f91eedbd6219cd3648cf1085083990df5c0e77dd (diff) | |
download | tcl-26a76b6c669bbb7629454ffa56a7f3f501a86dae.zip tcl-26a76b6c669bbb7629454ffa56a7f3f501a86dae.tar.gz tcl-26a76b6c669bbb7629454ffa56a7f3f501a86dae.tar.bz2 |
Initial revision
FossilOrigin-Name: cacdd0f329872d67973970d74c6978730bc24baa
Diffstat (limited to 'doc/case.n')
-rw-r--r-- | doc/case.n | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/doc/case.n b/doc/case.n new file mode 100644 index 0000000..d375288 --- /dev/null +++ b/doc/case.n @@ -0,0 +1,59 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +'\" SCCS: @(#) case.n 1.8 96/03/25 20:10:49 +'\" +.so man.macros +.TH case n 7.0 Tcl "Tcl Built-In Commands" +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +case \- Evaluate one of several scripts, depending on a given value +.SH SYNOPSIS +\fBcase\fI string \fR?\fBin\fR? \fIpatList body \fR?\fIpatList body \fR...? +.sp +\fBcase\fI string \fR?\fBin\fR? {\fIpatList body \fR?\fIpatList body \fR...?} +.BE + +.SH DESCRIPTION +.PP +\fINote: the \fBcase\fI command is obsolete and is supported only +for backward compatibility. At some point in the future it may be +removed entirely. You should use the \fBswitch\fI command instead.\fR +.PP +The \fBcase\fR command matches \fIstring\fR against each of +the \fIpatList\fR arguments in order. +Each \fIpatList\fR argument is a list of one or +more patterns. If any of these patterns matches \fIstring\fR then +\fBcase\fR evaluates the following \fIbody\fR argument +by passing it recursively to the Tcl interpreter and returns the result +of that evaluation. +Each \fIpatList\fR argument consists of a single +pattern or list of patterns. Each pattern may contain any of the wild-cards +described under \fBstring match\fR. If a \fIpatList\fR +argument is \fBdefault\fR, the corresponding body will be evaluated +if no \fIpatList\fR matches \fIstring\fR. If no \fIpatList\fR argument +matches \fIstring\fR and no default is given, then the \fBcase\fR +command returns an empty string. +.PP +Two syntaxes are provided for the \fIpatList\fR and \fIbody\fR arguments. +The first uses a separate argument for each of the patterns and commands; +this form is convenient if substitutions are desired on some of the +patterns or commands. +The second form places all of the patterns and commands together into +a single argument; the argument must have proper list structure, with +the elements of the list being the patterns and commands. +The second form makes it easy to construct multi-line case commands, +since the braces around the whole list make it unnecessary to include a +backslash at the end of each line. +Since the \fIpatList\fR arguments are in braces in the second form, +no command or variable substitutions are performed on them; this makes +the behavior of the second form different than the first form in some +cases. + +.SH KEYWORDS +case, match, regular expression |