Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to pause the console in F# language

Tags:

f#

Please tell me how I can pause the console window when running the program in F#.

open System
let myList = [0..9]
let myFunction =
for n in myList do
    Console.WriteLine(n)
myFunction
like image 628
user1717327 Avatar asked Mar 09 '13 07:03

user1717327


Video Answer


2 Answers

I am guessing that you want the console to display the output after the program execution finishes.

You could put this line in the end of your snippet

Console.ReadKey() |> ignore

to 'pause' the console in that sense.

like image 184
Srikanth Venugopalan Avatar answered Sep 17 '22 19:09

Srikanth Venugopalan


You may consider to wrap the pause function in compiler directives, since you probably don't want to have the same effect in release code.

(* your code here *)
#if DEBUG
System.Console.ReadKey(true) |> ignore 
#endif
like image 26
Jack Tang Avatar answered Sep 19 '22 19:09

Jack Tang