val is better than Java's final? JavaScript hoisting var r = double(1) + triple(1); function double(x) {return x * 2;} var triple = function(x) {return x * 3;} Throws: java.lang.NullPointerException at Vals.<init>(Vals.scala:2) Simplified class Vals { println(answer) private[this] val answer = 42 } Prints... 0 return in lambda def samples(xs: TraversableOnce[Int]) { xs map {x => return x * 10} for