Initial revision
[LeanCalc.git] / help / oldvalue
1 NAME
2     . - oldvalue
3
4 SYNOPSIS
5     .  (with no adjacent letters or digits or _ or .)
6
7 TYPES
8     return      any
9
10 DESCRIPTION
11     The "old value" is essentially a global variable with identifier "."
12     which at top level when directly from a file or keyboard
13     is automatically assigned the saved value for a line
14     of statements when evaluation of that line is completed and this saved
15     value is not null.  A line of statements is normally completed by a
16     '\n' not within a block bounded by braces or an expression bounded by
17     parentheses.
18
19     Disabling of saving by calling saveval(0) causes lines to return a
20     null value and . then becomes in effect a global variable whose
21     value may be changed by assignments and operations like ++ and --.
22
23     A null value may be assigned to . by . = null() or free(.).
24
25 EXAMPLE
26     > saveval(1);
27     > a = 2
28     > .
29             2
30     > . += 3; b = . + 4
31     > print ., b
32     9 9
33     > . += 3; b = . + 4; null()
34     > print ., b
35     12 16
36     > list(a, b, a + b)
37
38     list (3 elements, 3 nonzero):
39             [[0]] = 2
40             [[1]] = 16
41             [[2]] = 18
42
43     > saveval(0)
44     > print pop(.), .[[1]]
45     2 18
46
47 LIMITS
48     none
49
50 LINK LIBRARY
51     none
52
53 SEE ALSO
54     saveval
55