diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-10-17 10:22:24 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-10-17 10:22:24 (GMT) |
commit | 842e3ff91428c72a2ce0d4df4889778af82f4b12 (patch) | |
tree | 5a94240e321022019f593f6bd712833ab12138c6 /doc/foreach.n | |
parent | 8b464633a0f2df93912ad25af65a5724cd643da2 (diff) | |
download | tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.zip tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.tar.gz tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.tar.bz2 |
Improve clarity of formatting.
Diffstat (limited to 'doc/foreach.n')
-rw-r--r-- | doc/foreach.n | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/foreach.n b/doc/foreach.n index 949db4c..47488c7 100644 --- a/doc/foreach.n +++ b/doc/foreach.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: foreach.n,v 1.10 2007/12/13 15:22:32 dgp Exp $ +'\" RCS: @(#) $Id: foreach.n,v 1.11 2008/10/17 10:22:25 dkf Exp $ '\" .so man.macros .TH foreach n "" Tcl "Tcl Built-In Commands" @@ -51,8 +51,10 @@ The \fBbreak\fR and \fBcontinue\fR statements may be invoked inside \fIbody\fR, with the same effect as in the \fBfor\fR command. \fBForeach\fR returns an empty string. .SH EXAMPLES +.PP This loop prints every value in a list together with the square and cube of the value: +.PP .CS '\" Maintainers: notice the tab hacking below! .ta 3i @@ -65,6 +67,7 @@ puts "Value\etSquare\etCube" ;# Neat-looking header .PP The following loop uses i and j as loop variables to iterate over pairs of elements of a single list. +.PP .CS set x {} \fBforeach\fR {i j} {a b c d e f} { @@ -75,6 +78,7 @@ set x {} .CE .PP The next loop uses i and j to iterate over two lists in parallel. +.PP .CS set x {} \fBforeach\fR i {a b c} j {d e f g} { @@ -85,6 +89,7 @@ set x {} .CE .PP The two forms are combined in the following example. +.PP .CS set x {} \fBforeach\fR i {a b c} {j k} {d e f g} { |