2 ms·
scala> def f(x: Int) = if (x % 2 == 0) { x } else { None } f: (x: Int)Any Which is expected. The only shared type between both branches of the `if` express
by azth 12y ago
scala> def f(x: Int) = if (x % 2 == 0) { x } else { None }
f: (x: Int)Any
Which is expected. The only shared type between both branches of the `if` expression is `Any`.