Contents | Prev | Next | Index
The purpose of an assignment is to replace the current value of a variable with a new value specified by an expression. The expression must be assignment compatible with the variable. The assignment operator is written as ":=" and stands for becomes.
| assignment ::= left_designator := expr left_designator ::= designator |
If an expression e of type Te is assigned to a variable v of type tv, the following happens:
The following are examples of assignments (refer to examples in the section about variable declarations):
| i := 0 | |
| p := i=j | |
| x := i+1 | |
| k := log2(i+j) | (* see procedure declaration examples *) |
| F := log2 | (* see procedure declaration examples *) |
| s := {2,3,5,7,11,13} | |
| a[i] := (x+y) * (x-y) | |
| t.key := i | |
| w[i+1].name := "John" | |
| t := c |
Contents | Prev | Next | Index
Canterbury Oberon-2 for Java (Last documentation update
Feb 8, 2000)
Copyright © 1998 Mill Hill &
Canterbury Corporation, Ltd. All rights reserved
Please send any comments or corrections to
mhc@webcom.com