Possible Duplicate:
F#: This expression should have type 'unit', but has type 'ConsoleKeyInfo'
I'm learning F# so i wrote a 3 lines of code in VS2010 and I want to see the result but the console closes. System.Console.Read System.Console.ReadKey or commands like that just don't work. Any other way to stop console from closing?
let x = 20
let y = x = 20
printf "is x 20? %d" y
System.Console.ReadKey
you need to do
System.Console.ReadKey() |> ignore
at the end to require a key press to exit - the ()
is to actually call the function and |> ignore
is because you don't care about the result
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With