sml Interactive Programming using the REPL Using 'it'


Example

All SML expressions return a value. The REPL stores the return value of the last evaluated expression. it provides the value of the last evaluated expression within the REPL.

smluser> sml
Standard ML of New Jersey v110.78 [built: Thu Jul 23 11:21:58 2015]
- 3+4;
val it = 7 : int
- it;
val it = 7 : int
- it + 1;
val it = 8 : int
-

[1]+  Stopped                 sml
smluser>

Effectively, comments are not evaluated by the REPL and do not change the value of it.

smluser> sml
Standard ML of New Jersey v110.78 [built: Thu Jul 23 11:21:58 2015]
- 3+4;
val it = 7 : int
- (* a comment *);
- it;
val it = 7 : int

[1]+  Stopped                 sml
smluser>