First Steps in Scala

1 定义变量

scala> val msg = "Hello, world!"

2 定义函数

def max(x: Int, y: Int): Int = {
    if (x > y) x
    else y
}

3 参数

args.foreach(arg => println(arg))

输入

scala test.scala a b c

打印结果

a
b
c

results matching ""

    No results matching ""