What does "Forward reference extends over definition of value" mean in Scala?

Basically it's a bug.

The fix is to declare a method before calling it. I don't know why.

def a(input: String){

}

val k = a("ravi")

The error message means that you have a forward reference to a method, i.e. you're calling a method before you define it, and that the definition of the value x appears between that forward reference and the definition of the method. It is only legal to have forward references if there are no value definition between the reference and the referred method definiton.

Tags:

Scala