Note that there are some explanatory texts on larger screens.

plurals
  1. POF# WPF events: "Block following this 'let' is unfinished. Expect an expression"
    text
    copied!<p>This is driving me nuts. I am looking <a href="http://msdn.microsoft.com/en-us/library/vstudio/dd233229.aspx" rel="nofollow">here</a> at Microsoft's function examples. I can't see what I am doing wrong.</p> <p>So, I am trying to use F# with WPF, I found a working online project template for it. <a href="http://visualstudiogallery.msdn.microsoft.com/e0907c99-bb04-4eb8-9692-9333d5ff4399" rel="nofollow">Here it is</a> .I was about to get started. Unfortunately, the designer does not work for generating events in the F# code by double clicking an element like it does in C#. But oh well, I can set what the Click does anyway. I decided I would do it all manually. </p> <p>Here is my flawed attempt:</p> <pre><code>module MainApp open System open System.Windows open System.Windows.Controls open FSharpx let mutable doc = "" type MainWindow = XAML&lt;"MainWindow.xaml"&gt; let loadWindow() = let window = MainWindow() // Your awesome code code here and you have strongly typed access to the XAML via "window" window.Root let make (sender:Object, e:RoutedEventArgs) = doc&lt;- doc +"&lt;?xml version=\"1.0\" standalone=\"no\"?&gt;" 0 [&lt;STAThread&gt;] (new Application()).Run(loadWindow()) |&gt; ignore </code></pre> <p>In any event, It does not like the line with let make on it. It gives me this error:</p> <pre><code>Block following this 'let' is unfinished. Expect an expression </code></pre> <p>And yet, clearly I read on the MSDN</p> <pre><code> The compiler uses the final expression in a function body to determine the return value and type </code></pre> <p>So, it has a return, how is it an unfinished expression?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload