Next: regcoefs()
Up: MacAnova Help File
Previous: readdata()
Contents
Usage:
redo() or redo(charVar) where charVar is CHARACTER scalar
REDO()
|
Keywords:
control
redo() re-executes the previous line. It can be used in an expression
3*redo() or as an argument to a function (sqrt(redo())).
What redo() actually does is the following:
1. redo() creates a macro REDO from the entire preceding command line
which is automatically saved as variable LASTLINE
2. redo() then executes REDO, thus re-running the preceding command
line. Re-execution may not be exact. If the preceding line
consisted of several commands separated by semi-colons, they will
all be executed, but values that are not assigned will not be
printed, except for the final command. And even if the final
command in the preceding line is an assignment, its value may be
printed.
In later lines, just typing REDO() will re-execute this line (until a
subsequent use of redo()).
Caution: do not attempt to use redo() immediately following a line
containing redo() or REDO(), as this leads to uncontrolled recursion.
redo(charVar) also creates macro REDO and executes it, but the contents
of REDO come from CHARACTER scalar charVAR rather than LASTLINE.
redo() is implemented as a pre-defined macro.
Examples:
Cmd> print(paste("Pi =",PI))
Pi = 3.1416
Cmd> redo() # previous command repeated
Pi = 3.1416
Cmd> REDO() # redone command repeated
Pi = 3.1416
Cmd> pi <- PI # line ending in assignment
Cmd> redo() # previous line executed and value of assignment printed
(1) 3.1416
Cmd> pi <- PI ;; # note trailing ;; so last command is null
Cmd> redo() # previous line executed and nothing printed
Cmd>
See also topics edit(), 'macros', 'syntax'.
Gary Oehlert
2003-01-15