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

前端 未结 7 1297
春和景丽
春和景丽 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

    0 讨论(0)
提交回复
热议问题