return value to break function
<p>I am completely new to F# (started using it today) and relatively new to functional programming (I have minor experience with Lisp). I want to exit a function by returning a value when a certain condition is met so that the rest of the loop is not executed. Here is a C# illustration of what I want to do:</p>

<pre><code>bool CheckRow (int n, int i)
{
    for(int j = 0; j &lt; 9; j++)
        if (n == sudoku[i][j])
            return false;

    return true;
}
</code></pre>

<p>I tried implementing the same function in F# like this (sudoku is an array2D):</p>

<pre><code>let CheckRow (n : int) (i : int) : bool = 

    for j = 0 to 8 do
        if (n = sudoku.[i, j]) then
            false

    true
</code></pre>

<p>However, I get the following error at false within the if: "This expression was expected to have type unit but here has type bool". What is the proper way to "return" from within a F# function?</p>