diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-10-27 14:23:38 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-10-27 14:23:38 (GMT) |
commit | 45beb64f7dcb09a6ce83532702bca760f72e6f4d (patch) | |
tree | f7746a2a8316d612570e1456524e3d182e855c82 /doc/set.n | |
parent | 5bc57d7b0f63d86fc383565d69f7704943fff94d (diff) | |
download | tcl-45beb64f7dcb09a6ce83532702bca760f72e6f4d.zip tcl-45beb64f7dcb09a6ce83532702bca760f72e6f4d.tar.gz tcl-45beb64f7dcb09a6ce83532702bca760f72e6f4d.tar.bz2 |
Yet more doc update backporting
Diffstat (limited to 'doc/set.n')
-rw-r--r-- | doc/set.n | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -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: set.n,v 1.3.18.1 2004/05/24 19:24:37 msofer Exp $ +'\" RCS: @(#) $Id: set.n,v 1.3.18.2 2004/10/27 14:23:58 dkf Exp $ '\" .so man.macros .TH set n "" Tcl "Tcl Built-In Commands" @@ -41,6 +41,32 @@ If a procedure is active and \fIvarName\fR is unqualified, then \fIvarName\fR refers to a parameter or local variable of the procedure, unless \fIvarName\fR was declared to resolve differently through one of the \fBglobal\fR, \fBvariable\fR or \fBupvar\fR commands. +.SH EXAMPLES +Store a random number in the variable \fIr\fR: +.CS +\fBset\fR r [expr rand()] +.CE +.PP +Store a short message in an array element: +.CS +\fBset\fR anAry(msg) "Hello, World!" +.CE +.PP +Store a short message in an array element specified by a variable: +.CS +\fBset\fR elemName "msg" +\fBset\fR anAry($elemName) "Hello, World!" +.CE +.PP +Copy a value into the variable \fIout\fR from a variable whose name is +stored in the \fIvbl\fR (note that it is often easier to use arrays in +practice instead of doing double-dereferencing): +.CS +\fBset\fR in0 "small random" +\fBset\fR in1 "large random" +\fBset\fR vbl in[expr {rand() >= 0.5}] +\fBset\fR out [\fBset\fR $vbl] +.CE .SH "SEE ALSO" expr(n), global(n), namespace(n), proc(n), trace(n), unset(n), upvar(n), variable(n) |