如何以F#语言暂停控制台 [英] how to pause the console in F# language

查看:47
本文介绍了如何以F#语言暂停控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我在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

推荐答案

您可能考虑将暂停函数包装在编译器指令中,因为您可能不希望在发布代码中产生相同的效果.

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

这篇关于如何以F#语言暂停控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆