Not specifying the return type of a method is part of the procedural syntax and is deprecated. In such cases, the compiler assumes that the return type of such method is Unit. Any explicit return statements inside such methods have no effect and are discarded.
def foo() {
return 1 // This return statement has no effect!
}
foo() // returns nothing!
def foo(): Int = {
return 1
}