Parameterless methods usually return a value and are part of the language. Having such methods have a return type of Unit can affect/hinder readability and defeats the purpose for which it was introduced as part of the syntax/language.
// This method, judging by its name, suggests that it might return something as it is parameterless, when in reality
// it doesn't return anything!
def foo: Unit = {
// body
}
def foo(): Unit = {
// body
}
A general way of using parameterless method is -
def name: String = {
// body
}
println(user.name)