title: Why do I use `let` and not just `val` to declare a variable inside a function in SML?
body: <p>In SML, I've been taught the idiomatic way to define a variable local to the function as:</p>
  
  <pre><code>fun correct_fun() =
      let val x = 1
      in x + 2
      end
  </code></pre>
  
  <p>Why do I have to use <code>let</code>, and not just <code>val</code> like so:</p>
  
  <pre><code>fun incorrect_fun() =
      val x = 1
      x + 2
  </code></pre>
  
  <p>The <code>incorrect_fun()</code> throws an error but I don't understand why. Why can't val be used inside a function without <code>let</code>?</p>