When to use the equals sign in a Scala method declaration?

前端 未结 7 1302
春和景丽
春和景丽 2020-11-28 05:09

With equals sign:

object HelloWorld {
  def main(args: Array[String]) = {
    println(\"Hello!\")
  }
}

Without equals sign:



        
7条回答
  •  生来不讨喜
    2020-11-28 06:06

    One thing : imagine the last statement of a method that should return Unit does not return Unit. Using the non-equal syntax is then very convenient, I hope this will not be deprecated as I see several use case for it

提交回复
热议问题