Skip to content

Commit 347d8bd

Browse files
author
sfeam
committed
clarify the scope of gnuplot variables
1 parent 0a3035e commit 347d8bd

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

docs/gnuplot.doc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
C RCS $Id: gnuplot.doc,v 1.1111 2017-10-03 23:42:41 sfeam Exp $
1+
C RCS $Id: gnuplot.doc,v 1.1112 2017-10-08 19:10:41 sfeam Exp $
22
C
33
C Copyright (C) 1986 - 1993, 1998, 1999, 2000, 2001, 2004 Thomas Williams, Colin Kelley et al.
44
C
@@ -2559,14 +2559,21 @@ Ffigure_newsyntax
25592559

25602560
?scope
25612561
=scope
2562-
The scope of an iteration variable is private to that iteration.
2562+
With one exception, gnuplot variables are global.
2563+
There is a single, persistent, list of active variables indexed by name.
2564+
Assignment to a variable creates or replaces an entry in that list.
2565+
The only way to remove a variable from that list is the `undefine` command.
2566+
2567+
The single exception to this is the variable used in an iteration specifier.
2568+
The scope of the iteration variable is private to that iteration.
25632569
You cannot permanently change the value of the iteration variable inside the
25642570
iterated clause. If the iteration variable has a value prior to iteration,
25652571
that value will be retained or restored at the end of the iteration.
2566-
E.g. the following clause will iterate 10 times, after which i is again "A".
2572+
For example, the following commands will print 1 2 3 4 5 6 7 8 9 10 A.
25672573

25682574
i = "A"
2569-
do for [i=1:10] { i=10 }
2575+
do for [i=1:10] { print i; i=10; }
2576+
print i
25702577

25712578
2 linetypes, colors, and styles
25722579
?linetypes

0 commit comments

Comments
 (0)