| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (11 out of 25)

Assignment (=)

This statement assigns a value to a local name in a procedure. The syntax is:

When the statement is executed, the expression is evaluated and that value is associated with the local-name to the left. The association persists until another assignment occurs. For example:

Here the first assignment sets the value of weight to 200. The value remains 200 until the subsequent assignment increments its value to 201.

The expression can be a call statement to a procedure that returns a value. That value is assigned to local-name:

For further information, including the syntax for obtaining multiple return values, see call.

An assignment statement does not cause data-seeking so it cannot contain any references to G2 variables. Use the collect data statement to assign the value of a variable to a local name, as described under collect data.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (11 out of 25)

Copyright © 1997 Gensym Corporation, Inc.