![Scalaスケーラブルプログラミング[コンセプト&コーディング] (Programming in Scala) Scalaスケーラブルプログラミング[コンセプト&コーディング] (Programming in Scala)](http://ecx.images-amazon.com/images/I/41nFY0KbnfL._SL160_.jpg)
Scalaスケーラブルプログラミング[コンセプト&コーディング] (Programming in Scala)
- 作者: Martin Odersky,Lex Spoon、Bill Venners,羽生田栄一,長尾高弘
- 出版社/メーカー: インプレスジャパン
- 発売日: 2009/08/21
- メディア: 単行本
- 購入: 17人 クリック: 639回
- この商品を含むブログ (120件) を見る
勉強開始。
関数定義。全部書いた場合。
def hello(x: String) : String = { return "hello " + x }
return を省略できる
def hello(x: String) : String = { "hello " + x }
一行にする
def hello(x: String) = "hello " + x
こうすると・・・void になる??
def hello(x: String) { "hello " + x } print(hello("basyura")) //=> () print(hello("basyura").getClass) //=>class scala.Predef$$anon$1
読み進めよう。