[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Assignment

Assignment

An assignment is an association of an identifier to a value. The statement,


> a := 6;
establishes an association between the identifier a and the value 6 (6 is said to be the value of a, or to be assigned to a). A collection of such assignments is called a context.

When a value V is assigned to an identifier I one of two things happens:

The ability to assign and re-assign to identifiers is why Magma is called an imperative language.

One very important point about assignment is illustrated by the following example. Say we type,


> a := 6;
> b := a+7;
After executing these two lines the context is [ (a,6), (b,13) ]. Now say we type,


> a := 0;
The context is now [ (a,0), (b,13) ]. Note that changing the value of a does not change the value of b because b's value is statically determined at the point where it is assigned. Changing a does not produce the context [ (a,0), (b,7) ].
[Next] [Prev] [Right] [Left] [Up] [Index] [Root]