【问题标题】:How do I get input from the console in Nim?如何从 Nim 的控制台获取输入?
【发布时间】:2021-03-20 23:38:07
【问题描述】:

我是 Nim 的新手,但似乎无法以类似于 python 中的input() 或 dotnet 中的Console.ReadLine() 的方式从控制台获取输入。

我希望暂停执行我的代码,等待输入,然后按 Enter 键继续(就像其他语言中的输入一样)。

【问题讨论】:

    标签: console console-application nim-lang


    【解决方案1】:

    哦不,没关系找到它:

    var consoleInput = readLine(stdin);
    

    【讨论】:

    • 分号是可选的 :) 你也可以像stdin.readLine() 那样做。
    • 啊,谢谢 :) 来自 C# 我更喜欢分号
    • 此外,标准库中包含用于更高级功能(历史、完成...)的 linenoise。
    猜你喜欢
    • 1970-01-01
    • 2012-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-12
    • 1970-01-01
    相关资源
    最近更新 更多