title: C# To F# loops to return a value
body: <p>How to Write this code in f#</p>
  
  <pre><code> int IAI.AIMove()
      {
          for (int i = 0; i &lt;= 8; i++)
              if (cBoard.getPlayer(i) == 0)
                  return i;
          return 0;
      }
  </code></pre>
  
  <p>This is what i have</p>
  
  <pre><code>member this.AIMove()=
        let result =  int in
          for i in 1 .. 8 do
              if cboard.getPlayer(i)=0 then
                 result := Some i
  </code></pre>
  
  <p>[error] 
  This expression was expected to have type     int     but here has type     unit </p>