Assignment Operators

Assignment Operators — (=, :=, ::=)

Syntax

symbol = s_exp
symbol := s_exp
symbol ::= s_exp

		

Arguments

symbol

Any valid symbol.

s_exp

Any expression.

Returns

The assigned value.

Description

is used to assign a value to a variable.

:=  is used to assign a value only if no value is currently assigned to the symbol. If the symbol already has a value then the symbol keeps its original value.

::=  is used to assign a constant. Once the assignment has been made no changes to the symbol are allowed. Attempted changes to the symbol will generate an error.

Example

Gamma> a = 5;
5
Gamma> a := 6;
5
Gamma> a;
5
Gamma> b ::= 7;
7
Gamma> b = 8;	
Assignment to constant symbol: b
debug 1> 
Gamma> b ::= 9;
Defvar of defined constant: b
debug 1> 
Gamma>  
		

See Also

defvar