target = qualified_name {`(' {expression} `)'}
An assignment target is the name of a variable (as opposed to the name of a constant, function or procedure), optionally followed by subscript expressions.
If subscripted, the name must represent a list, string or map value. In the latter case, a multi-dimensional subscript may be used. For example:
s(2) := `x' !s in String+List m(`a', 2) := 2.5 !m in map from String, Integer to Number
If the component selected by the first subscript is itself a list, string or map value, a second subscript may be used, and so on. For example:
l := [1 [2 [3 4]]] l(2)(2)(1) *:= 10 assert l = [1 [2 [30 4]]]
It is also possible to assign to a subscripted function name. The assigned value is then returned, without executing the function, whenever the function is evaluated for the same arguments used in the assignment. For example:
func f(x); return x+1; endf f(1) := 10 assert f(1) = 10 and not f(1) = 2
However, should there be a procedure with the same name as the function, the procedure is called with the subscript values and expression as parameters. For example:
G : list of Integer := [] func f(x); return x+1; endf proc f(x,y); G := [x, y]; endp f(1) := 10 assert f(1) = 2 and not f(1) = 10 and G = [1, 10]