Hello World in Scala



examples/HelloWorld.scala
object HelloWorld {
    def main(args:Array[String]) {
        println("Hello World!")
    }
}

Run Hello World in the REPL


$ scala
scala> :load Hello.scala
scala> Hello.main(null)
scala> Hello.main(Array())


$ scalac  HelloWorld.scala
$ scala   HelloWorld
Hello World!


examples/HelloName.scala
object HelloName {
    def main(args:Array[String]) {
        val name:String = args(0)
        println("Hello " + name + "!")
    }
}