def f: (Int, Int) => (Int, Int) => List[Int] = {
(x, y) => (a, b) =>
//do anything
if(y == 5)
return List(a, x)
// do something else
}
When I use this, Intellij says:
type mismatch;
found :List[Int]
required: (Int, Int) => (Int, Int) => List[Int]
return List(a,x)
If I do the same, without return (which wouldn't work, if there is code after it), there is no error. Why does the return need this type?