1. Through interpreter
$ cat script.scala
println("Hello, World!")
2. Thought a Scala script
$ cat script.scala
#!/usr/bin/scala!#
println("Hello, World!")
Run as:
$ ./script.scala
3. Compile and then run compiled class
, source.
$ cat script.scala
object Greeting {
def main(args: Array[String]) = println("Hello world!")
}
Run as:
$ scalac script.scala
$ scala Greeting
Happy scripting!
$ cat script.scala
println("Hello, World!")
Run:
scala script.scala
$ cat script.scala
#!/usr/bin/scala!#
println("Hello, World!")
Run as:
$ ./script.scala
3. Compile and then run compiled class
, source.
$ cat script.scala
object Greeting {
def main(args: Array[String]) = println("Hello world!")
}
Run as:
$ scalac script.scala
$ scala Greeting
Happy scripting!
No comments:
Post a Comment