4 Program Control
:=
is used to set variables to new values and as an alternate syntax for calling setter functions and macros.The assignment operator is described in detail on page 395.
The following examples show the use of :=
to change the value of a module binding.
define variable *foo* = 10; *foo*The following examples show the use ofÞ 10 *foo* := *foo* + 100;
Þ 110 *foo*
Þ 110
:=
as shorthand for calling a setter function. In general, using this syntax to call a function fun is equivalent to calling the function fun-setter
.
define variable *foo* = vector (10, 6, 8, 5); element(*foo*, 2)The following examples show the use ofÞ 8 element(*foo*, 2) := "bar"
Þ "bar" *foo*
Þ #[10, 6, "bar", 5]
:=
as shorthand for calling a setter function using slot access notation.
window.position := point(100, 100) vector.size := 50The following examples show the use of
:=
as shorthand for calling element-setter
or aref-setter
.
my-vector[2] := #"two" my-array[1,1] := #"top-left"
Generated with Harlequin WebMaker