summaryrefslogtreecommitdiffstats
path: root/doc/while.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-05-05 22:08:08 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-05-05 22:08:08 (GMT)
commit4149000e58b323d2eab144b32acfa9f62e8576f1 (patch)
tree884440c3281c800096ae9cfc9671820ee7b95210 /doc/while.n
parentff3d3775756945e7174da795eb668a5f88016267 (diff)
downloadtcl-4149000e58b323d2eab144b32acfa9f62e8576f1.zip
tcl-4149000e58b323d2eab144b32acfa9f62e8576f1.tar.gz
tcl-4149000e58b323d2eab144b32acfa9f62e8576f1.tar.bz2
More examples.
Diffstat (limited to 'doc/while.n')
-rw-r--r--doc/while.n11
1 files changed, 10 insertions, 1 deletions
diff --git a/doc/while.n b/doc/while.n
index ba5a584..e1c2ec3 100644
--- a/doc/while.n
+++ b/doc/while.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: while.n,v 1.3 2000/09/07 14:27:52 poenitz Exp $
+'\" RCS: @(#) $Id: while.n,v 1.4 2004/05/05 22:08:10 dkf Exp $
'\"
.so man.macros
.TH while n "" Tcl "Tcl Built-In Commands"
@@ -50,6 +50,15 @@ while {$x<10} {
incr x
}
.CE
+.SH EXAMPLE
+Read lines from a channel until we get to the end of the stream, and
+print them out with a line-number prepended:
+.CS
+set lineCount 0
+while {[gets $chan line] >= 0} {
+ puts "[incr lineCount]: $line"
+}
+.CE
.SH "SEE ALSO"
break(n), continue(n), for(n), foreach(n)