title: Ocaml type error
body: <p>I'm learning OCaml, and this is my first typed language, so try to be patient with me:</p>
  
  <p>For practice, I'm trying to define a function "divides?" which inputs two ints and outputs a boolean describing whether 'int a' divides evenly into 'int b'. In my first attempt, I wrote something like this:</p>
  
  <pre><code>let divides? a b =
  if a mod b = 0 then true
  else false;; 
  </code></pre>
  
  <p>which gave the type error:</p>
  
  <pre><code>if a mod b = 0 then true
    ^
  Error: This expression has type 'a option
         but an expression was expected of type int
  </code></pre>
  
  <p>So then I tried to turn it around and I did this:</p>
  
  <pre><code>let divides? a b =
   match a mod b with
    0 -&gt; true
   |x -&gt; false;;
  </code></pre>
  
  <p>which didn't help much: 
     <code>Characters 26-27
         match a mod b with
               ^
      Error: This expression has type 'a option
             but an expression was expected of type int</code></p>
  
  <p>Then I tried this:</p>
  
  <pre><code>let divides? (a : int) (b : int) =
   match a mod b with
   0 -&gt; true
  |x -&gt; false;;
  </code></pre>
  
  <p>which elicited this:
            Characters 14-15:
           let divides? (a : int) (b : int) =
                        ^
       Error: This pattern matches values of type int
              but a pattern was expected which matches values of type 'a option.</p>
  
  <p>I'm very confused and frustrated regarding the type system in general right now. (My first language was Scheme, this is my second.) Any help explaining where I'm going wrong and suggestions on how to fix it is much appreciated.</p>