1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1993 The Regents of the University of California.
|
3 |
|
|
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
4 |
|
|
'\"
|
5 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
6 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
7 |
|
|
'\"
|
8 |
|
|
'\" RCS: @(#) $Id: set.n,v 1.1.1.1 2002-01-16 10:25:25 markom Exp $
|
9 |
|
|
'\"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.TH set n "" Tcl "Tcl Built-In Commands"
|
12 |
|
|
.BS
|
13 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
14 |
|
|
.SH NAME
|
15 |
|
|
set \- Read and write variables
|
16 |
|
|
.SH SYNOPSIS
|
17 |
|
|
\fBset \fIvarName \fR?\fIvalue\fR?
|
18 |
|
|
.BE
|
19 |
|
|
|
20 |
|
|
.SH DESCRIPTION
|
21 |
|
|
.PP
|
22 |
|
|
Returns the value of variable \fIvarName\fR.
|
23 |
|
|
If \fIvalue\fR is specified, then set
|
24 |
|
|
the value of \fIvarName\fR to \fIvalue\fR, creating a new variable
|
25 |
|
|
if one doesn't already exist, and return its value.
|
26 |
|
|
If \fIvarName\fR contains an open parenthesis and ends with a
|
27 |
|
|
close parenthesis, then it refers to an array element: the characters
|
28 |
|
|
before the first open parenthesis are the name of the array,
|
29 |
|
|
and the characters between the parentheses are the index within the array.
|
30 |
|
|
Otherwise \fIvarName\fR refers to a scalar variable.
|
31 |
|
|
Normally, \fIvarName\fR is unqualified
|
32 |
|
|
(does not include the names of any containing namespaces),
|
33 |
|
|
and the variable of that name in the current namespace is read or written.
|
34 |
|
|
If \fIvarName\fR includes namespace qualifiers
|
35 |
|
|
(in the array name if it refers to an array element),
|
36 |
|
|
the variable in the specified namespace is read or written.
|
37 |
|
|
.PP
|
38 |
|
|
If no procedure is active,
|
39 |
|
|
then \fIvarName\fR refers to a namespace variable
|
40 |
|
|
(global variable if the current namespace is the global namespace).
|
41 |
|
|
If a procedure is active, then \fIvarName\fR refers to a parameter
|
42 |
|
|
or local variable of the procedure unless the \fBglobal\fR command
|
43 |
|
|
was invoked to declare \fIvarName\fR to be global,
|
44 |
|
|
or unless a \fBvariable\fR command
|
45 |
|
|
was invoked to declare \fIvarName\fR to be a namespace variable.
|
46 |
|
|
|
47 |
|
|
.SH KEYWORDS
|
48 |
|
|
read, write, variable
|