This operator assigns a new value to a ref
.
let total = ref(0)
total := 1
A ref
is a builtin record type with a mutable contents
field. Therefore the :=
operator is just a shorthand version for the following code:
let total = ref(0)
total.contents = 1