Loc

Prev Next Home Home Table Of Contents Index

Loc (Procedure or Variable)

When used with a procedure, Loc returns the location of a procedure for storing in a variable. The variable is later executed using the Run command.

When used with a variable, Loc returns the location of a variable rather than it's contents. Thus B = Loc A sets B to point to A.


Example:
Var A B B = Loc A B = 9 Writeln A ;returns 9

Example:
Var A

TestLoc (Loc A) Writeln A ;returns 9

Procedure TestLoc (B) B = 9 EndProc

The rule is that all indirect location references are resolved in the process of evaluating an expression.


Example:
Var A B C D B = Loc A C = Loc B D = Loc C D = 9 Writeln A ; Returns 9

As you would expect, qualifiers and multidimensional array addressing works with indirect addressing.


Example:
var A B C D E

A[3] = 12 C = 3 B = Loc C

D = Loc E D[7] = 8

TestLoc (Loc A[B]) Writeln A[B,9,E[7]]

Procedure TestLoc (X) Writeln X X[9,D[7]] = 6 Writeln X[9,E[7]] EndProc

See Also: Run Actual

Category: Variable

Prev Next Home Home Table Of Contents Index

Sponsors
Shopping
Forum
Forum
email
EMail
Index
Index
Home
Home