summaryrefslogtreecommitdiffstats
path: root/doc/switch.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-10-17 10:22:24 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-10-17 10:22:24 (GMT)
commit842e3ff91428c72a2ce0d4df4889778af82f4b12 (patch)
tree5a94240e321022019f593f6bd712833ab12138c6 /doc/switch.n
parent8b464633a0f2df93912ad25af65a5724cd643da2 (diff)
downloadtcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.zip
tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.tar.gz
tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.tar.bz2
Improve clarity of formatting.
Diffstat (limited to 'doc/switch.n')
-rw-r--r--doc/switch.n7
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/switch.n b/doc/switch.n
index 21ecfc2..2f638de 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.19 2008/06/29 22:28:24 dkf Exp $
+'\" RCS: @(#) $Id: switch.n,v 1.20 2008/10/17 10:22:25 dkf Exp $
'\"
.so man.macros
.TH switch n 8.5 Tcl "Tcl Built-In Commands"
@@ -124,8 +124,10 @@ 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"
+.PP
The \fBswitch\fR command can match against variables and not just
literals, as shown here (the result is \fI2\fR):
+.PP
.CS
set foo "abc"
\fBswitch\fR abc a \- b {expr {1}} $foo {expr {2}} default {expr {3}}
@@ -134,6 +136,7 @@ set foo "abc"
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):
+.PP
.CS
\fBswitch\fR \-glob aaab {
a*b \-
@@ -145,6 +148,7 @@ writing regular expressions with alternations, as can be seen here
.PP
Whenever nothing matches, the \fBdefault\fR clause (which must be
last) is taken. This example has a result of \fI3\fR:
+.PP
.CS
\fBswitch\fR xyz {
a \-
@@ -163,6 +167,7 @@ last) is taken. This example has a result of \fI3\fR:
.PP
When matching against regular expressions, information about what
exactly matched is easily obtained using the \fB\-matchvar\fR option:
+.PP
.CS
\fBswitch\fR \-regexp \-matchvar foo \-\- $bar {
a(b*)c {