diff options
Diffstat (limited to 'doc/set.n')
-rw-r--r-- | doc/set.n | 9 |
1 files changed, 3 insertions, 6 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.2 2004/10/27 14:23:58 dkf Exp $ +'\" RCS: @(#) $Id: set.n,v 1.9 2007/12/13 15:22:33 dgp Exp $ '\" .so man.macros .TH set n "" Tcl "Tcl Built-In Commands" @@ -16,13 +16,12 @@ set \- Read and write variables .SH SYNOPSIS \fBset \fIvarName \fR?\fIvalue\fR? .BE - .SH DESCRIPTION .PP Returns the value of variable \fIvarName\fR. If \fIvalue\fR is specified, then set the value of \fIvarName\fR to \fIvalue\fR, creating a new variable -if one doesn't already exist, and return its value. +if one does not already exist, and return its value. If \fIvarName\fR contains an open parenthesis and ends with a close parenthesis, then it refers to an array element: the characters before the first open parenthesis are the name of the array, @@ -44,7 +43,7 @@ unless \fIvarName\fR was declared to resolve differently through one of the .SH EXAMPLES Store a random number in the variable \fIr\fR: .CS -\fBset\fR r [expr rand()] +\fBset\fR r [expr {rand()}] .CE .PP Store a short message in an array element: @@ -67,9 +66,7 @@ practice instead of doing double-dereferencing): \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) - .SH KEYWORDS read, write, variable |