Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# stop console from closing [duplicate]

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
like image 652
bljuvko Avatar asked Jun 12 '12 22:06

bljuvko


1 Answers

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

like image 160
John Palmer Avatar answered Nov 11 '22 18:11

John Palmer