Search code examples
smlsmlnj

What does val it = () : unit mean in SML?


I've never programmed in SML before, and I'm using SML/NJ. It keeps giving me the following at the end of each program I run:

val it = () : unit

What does this mean? Is it something I'm doing wrong?


Solution

  • it is the name of the result returned by your code. () : unit is a trivial placeholder value returned from things that are side-effect based.

    It's more obvious when you enter something that's more commonly an expression at the prompt, e.g...

    - 2 * 7;
      val it = 14 : int