projman/hlp/en/tcl/set.htm
2015-10-19 14:27:31 +04:00

41 lines
2.3 KiB
HTML

<HTML><HEAD><TITLE>Built-In Commands - set manual page</TITLE></HEAD><BODY>
<H3><A NAME="M2">NAME</A></H3>
set - Read and write variables
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>set </B><I>varName </I>?<I>value</I>?<BR>
<H3><A NAME="M4">DESCRIPTION</A></H3>
Returns the value of variable <I>varName</I>.
If <I>value</I> is specified, then set
the value of <I>varName</I> to <I>value</I>, creating a new variable
if one doesn't already exist, and return its value.
If <I>varName</I> 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,
and the characters between the parentheses are the index within the array.
Otherwise <I>varName</I> refers to a scalar variable.
Normally, <I>varName</I> is unqualified
(does not include the names of any containing namespaces),
and the variable of that name in the current namespace is read or written.
If <I>varName</I> includes namespace qualifiers
(in the array name if it refers to an array element),
the variable in the specified namespace is read or written.
<P>
If no procedure is active,
then <I>varName</I> refers to a namespace variable
(global variable if the current namespace is the global namespace).
If a procedure is active, then <I>varName</I> refers to a parameter
or local variable of the procedure unless the <B><A HREF="../TkCmd/global.htm">global</A></B> command
was invoked to declare <I>varName</I> to be global,
or unless a <B><A HREF="../TkCmd/variable.htm">variable</A></B> command
was invoked to declare <I>varName</I> to be a namespace variable.
<H3><A NAME="M5">SEE ALSO</A></H3>
<B><A HREF="../TkCmd/expr.htm">expr</A></B>, <B><A HREF="../TkCmd/proc.htm">proc</A></B>, <B><A HREF="../TkCmd/trace.htm">trace</A></B>, <B><A HREF="../TkCmd/unset.htm">unset</A></B>
<H3><A NAME="M6">KEYWORDS</A></H3>
<A href="../Keywords/R.htm#read">read</A>, <A href="../Keywords/W.htm#write">write</A>, <A href="../Keywords/V.htm#variable">variable</A>
<HR><PRE>
<A HREF="../copyright.htm">Copyright</A> &#169; 1993 The Regents of the University of California.
<A HREF="../copyright.htm">Copyright</A> &#169; 1994-1996 Sun Microsystems, Inc.
<A HREF="../copyright.htm">Copyright</A> &#169; 1995-1997 Roger E. Critchlow Jr.</PRE>
</BODY></HTML>