Sacala Warningメモ
環境 Scala 2.11.6 CentOS7.0
「Scalaスケーラブルプログラミング」(コップ本)メモ
読了:第04章まで
■ Warning
- 結果型がUnitのときに、最終行でUnit以外の型を返す式を評価している
scala> def f() { "this String gets lost"} <console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses def f() { "this String gets lost"} ^ f: ()Unit scala> def f2(): Unit = { 1 } <console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses def f2(): Unit = { 1 } ^ f2: ()Unit