Here is my code and I actually do not need any return values and types, and wondering how to handle this error?
Error of "overload method needs result type" is on this line foo (start, end, 14)
object HelloWorld {
def foo(start: String, end: String) = {
foo (start, end, 14)
}
def foo(start: String, end: String, id: Int) = {
println("Hello, world!")
}
def main(args: Array[String]): Unit = {
foo("hello", "scala")
}
}
Corrected version of code,
object HelloWorld {
def foo(start: String, end: String): Unit = {
foo (start, end, 14)
}
def foo(start: String, end: String, id: Int): Unit = {
println("Hello, world!")
}
def main(args: Array[String]): Unit = {
foo("hello", "scala")
}
}
thanks in advance, Lin