I am practising to code a function which returns a function.

There is an error as shown in screenshot.

Please let me know what is the problem.

@prasanthiImmadisetty please find below code. The mistake is usage of ‘else if’ statements. I don’t think scala supports else if statements.

```
val a = {
def chooseFunction(a:Int): (Int)=>Int = {
val i: (Int) => Int = (i: Int) => i
val s: (Int) => Int = (i: Int) => math.pow(i, 2).toInt
val c: (Int) => Int = (i: Int) => math.pow(i, 3).toInt
a match {
case 1 => i
case 2 => s
case 3 => c
}
}
def sum(f: Int => Int,a: Int, b: Int ): Int ={
if (a > b) 0 else f(a) + sum(f,a+1,b)
}
val p = chooseFunction(2)
println(p)
sum(p,5,10)
}
```

Next time please copy the code snippet rather than screen shot, it would be easy for the people to replicate your issue soon. Thanks!