Scala 腳本

環境: CentOS

第一印象:

創建一個hello.scala 腳本,腳本可以取任何名字任何後綴。

$ touch hello.scala
$ vim hello.scala
$ cat hello.scala
print("hello, this my first scala script")
$ scala hello.scala
hello, this my first scala

 

帶參數腳本:

$ touch helloargs.scala

$ cat helloargs.scala
print("hello my parameter "+ args(0) + " !")           //Java裏面是args[0]

$ scala helloargs.scala mypara
hello my parameter mypara !

 

發佈了40 篇原創文章 · 獲贊 2 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章