Download GRAPES USER`S MANUAL
Transcript
14-4 Variables and Substitution
Global Variables
May be used as variables within parameters, point coordinates, table cells, and scripts.
Local Variables
Four local variables (x, y, z, w) may be used. These variables are valid only within a script during
execution. For example, variable x in script A and variable x in script B are unrelated.
Real numbers and error values may be substituted in local variables. Use X and Y when handling
two-dimensional vector values with local variables. X is a variable set (x, y) and may therefore be written
X = (x, y). Similarly, Y = (z, w).
Example: X = (1, 2)
and
x := 1
y := 2
return the same result.
The initial value of a local variable is an error value which is discarded after execution. When a script is
called with the CALL command during execution of another script, the argument for the CALL statement
is substituted in these variables.
Example: If the following is written in a C language-like format,
//Sum
a := x+y
it appears as follows.
void Sum( x , y , z , w);
{a=x+y}
Substitution
Equation values may be substituted in parameters, point coordinates, table cells, and local variables x, y,
z, and w as follows.
Substitution object ;= equation
Leave a space between the substitution object and „:=‟.the same applies between „:=‟ and the equation.
If the equation has no value (e.g. 1/0) when substituting in parameters and points (coordinate
component), the substitution statement is not executed.
Parameter := equation
Example: a := sin t
101