Search code examples
smlsmlnjml

ML assignment operation


everyone, what is difference between the following assignments in ML,

val n = 5;

and

n := 1;

Solution

  • The former is a declaration of a new, immutable variable. The latter is how you re-assign the value of a reference cell.