scala用户输入正确,但在键入期间不显示

时间:2016-02-23 20:57:39

标签: scala cygwin

我正在编写一个简单的代码来接受用户输入年龄(double)并打印出输入值的多维数据集。

请参阅下面的代码和运行会话(我在cygwin窗口中运行):

我的问题是,当我输入控制台上的值时,即使整个过程正常工作,我也没有看到它被打字,我得到了正确的输出。

$ cat user_input_function.scala
// write some text out to the user with Console.println
Console.println("Hello")

// Console is imported by default, so it's not really needed, just use   println

的println("世界&#34)

// readInt lets you read an Int, but you have to prompt the user manually

打印("你多大了?")     val age = readDouble()

def cubed (x: Double) = x * x * x
//val a = 10
val b = cubed(age)
println (b)

u0124587@U0124587-TPL-B ~
$ scala user_input_function.scala
warning: there was one deprecation warning; re-run with -deprecation for     details
one warning found
Hello
World
How old are you? 1030.301

u0124587 @ U0124587-TPL-B~ $

感谢。真诚地感谢任何帮助。

0 个答案:

没有答案