2025.09.04
object helloworld {
def main(args: Array[String]): Unit = {
//获取用户的输入
//io: input 输入, output 输出
//scala.io.StdIn.readLine
val input = scala.io.StdIn.readLine("请输入一些文本:")
//用户输入完成,回车,内容就会保存到input这变量里
//输出
println("你输入的是:" + input)
}
}
object helloworld {
def main(args: Array[String]): Unit = {
//获取用户的输入
//io: input 输入, output 输出
//scala.io.StdIn.readLine
val input = scala.io.StdIn.readLine("请输入一些文本:")
//用户输入完成,回车,内容就会保存到input这变量里
//输出
println("你输入的是:" + input)
print("请输入年龄:")
val age = scala.io.StdIn.readLine()
print("请输入身高:米")
val height = scala.io.StdIn.readLine()
println("你输入的是:" + age)
println("你输入的是" + height)
}
}
println(s"$age 岁,$height 身高")//字符串插值