[ Non-logical Variables, Arrays, Bags, Shelves and Stores | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

local variable(+Name)

Creates the untyped non-logical variable Name.
+Name
An atom.

Description

If Name is an Atom, a non-logical variable (visible only in the caller module) is created. Its value is initialised to a free variable. The contents of the variable persists across failures. The value of a non-logical variable can be changed with setval/2 and retrieved with getval/2. Setting and retrieving terms from a non-logical variable involves copying the term each time. In particular, if the term contains variables, they lose their identity and are replaced with fresh ones.

Notes:

Declaring a variable twice is silently accepted.

It is possible to create variables with global visibility using global variable(A) but this feature will be removed in future releases.

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(4) instantiation fault
Name is not instantiated.
(5) type error
Name is not an atom.

Examples

Success:
      local variable(a).
      local variable(count), variable(value).

Error:
      local array(X).                        (Error 4).
      local array(6).                        (Error 5).

See Also

current_array / 2, array / 1, array / 2, decval / 1, incval / 1, bag_create / 1, getval / 2, setval / 2