SML# Document Version 3.7.1
19 Expressions

19.8 Sequential execution expression (exp1; ; expn)

This is the expression that executes from exp1 to expn in this order and returns the type and value of the last expression. Evaluation of SML# expressions contains side-effects in general. This expression is usually used to control side-effects. The following shows an example.

# val x = ref 1;
val x = ref 1 : int ref
# fun inc () = (x := !x + 1; !x);
val inc = fn : unit -> int
# inc();
val it = 2 : int
# inc();
val it = 3 : int

ref, :=, and ! in this example are builtin primitives for reference types described in Section 19.20.