Operators > Programming Operators > Local Assignment Operator
Local Assignment Operator
Operator
Description
Evaluates y numerically and assigns its contents to x. Variables and functions defined with this operator are only defined locally within a program.
Operands
x is any valid name for a variable or function.
y is any valid expression.
Additional Information
Local variables or functions defined with this operator can contain values defined in your worksheet. For example, you can define a := 2 in your worksheet and then define a local variable b ← a inside a program.
When you define a function locally, you do not need to include a list of arguments in the definition. For example, you can define f(x) ← g(x), f ← g, f(x) ← h(x, 2) or f ← F where F is an array of function names.
If you give a local variable the same name as the worksheet variable or function used to initialize it, the program only takes the worksheet value the first time the variable is assigned. In subsequent references to the same name, the program uses the local value rather than the global one. For example, if the function g(x) := x + 1 is defined in your worksheet and you define a variable g ← g(2), all subsequent program references to the name g use the local variable definition of 3 and no longer recognize g as a function name.
Local variables are never range variables, even if their value is a range. Use a For Loop instead.
A global range variable cannot be used in a function definition, due to the restriction that if a range variable appears on the right of an assignment (:=) it must also appear on the left.
Was this helpful?