diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-10-27 14:24:37 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-10-27 14:24:37 (GMT) |
commit | f2710bf0bb0c6ace5d1bc4f424b400537ffdb21c (patch) | |
tree | c19b22fbb2165682630fecbf3779e53b26c9002f /doc/switch.n | |
parent | 4c2d0f20bfa9108949678cf49bfdc58eedc7bb93 (diff) | |
download | tcl-f2710bf0bb0c6ace5d1bc4f424b400537ffdb21c.zip tcl-f2710bf0bb0c6ace5d1bc4f424b400537ffdb21c.tar.gz tcl-f2710bf0bb0c6ace5d1bc4f424b400537ffdb21c.tar.bz2 |
More minor doc fixes
Diffstat (limited to 'doc/switch.n')
-rw-r--r-- | doc/switch.n | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/doc/switch.n b/doc/switch.n index 3719a78..c508262 100644 --- a/doc/switch.n +++ b/doc/switch.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: switch.n,v 1.7 2004/04/22 22:36:22 dkf Exp $ +'\" RCS: @(#) $Id: switch.n,v 1.8 2004/10/27 14:24:37 dkf Exp $ '\" .so man.macros .TH switch n 7.0 Tcl "Tcl Built-In Commands" @@ -109,31 +109,30 @@ several patterns. Beware of how you place comments in \fBswitch\fR commands. Comments should only be placed \fBinside\fR the execution body of one of the patterns, and not intermingled with the patterns. - .SH "EXAMPLES" The \fBswitch\fR command can match against variables and not just literals, as shown here (the result is \fI2\fR): .CS set foo "abc" -switch abc a \- b {expr 1} $foo {expr 2} default {expr 3} +\fBswitch\fR abc a \- b {expr 1} $foo {expr 2} default {expr 3} .CE - +.PP Using glob matching and the fall-through body is an alternative to writing regular expressions with alternations, as can be seen here (this returns \fI1\fR): .CS -switch \-glob aaab { +\fBswitch\fR \-glob aaab { a*b \- b {expr 1} a* {expr 2} default {expr 3} } .CE - +.PP Whenever nothing matches, the \fBdefault\fR clause (which must be last) is taken. This example has a result of \fI3\fR: .CS -switch xyz { +\fBswitch\fR xyz { a \- b { # Correct Comment Placement @@ -147,12 +146,12 @@ switch xyz { } } .CE - +.PP .VS 8.5 When matching against regular expressions, information about what exactly matched is easily obtained using the \fB\-matchvar\fR option: .CS -switch -regexp -matchvar foo -- $bar { +\fBswitch\fR -regexp -matchvar foo -- $bar { a(b*)c { puts "Found [string length [lindex $foo 1]] 'b's" } |