Why does scala call the method passed to println before printing the line it is called in?

前端 未结 3 732
我在风中等你
我在风中等你 2021-01-23 18:09

The program looks like this ...

object Delay{

    def main(args: Array[String]){
        delayed(time())
    }

    def time()={
        println(\"Getting time          


        
3条回答
  •  旧时难觅i
    2021-01-23 19:00

    t/time value will be evaluated before printing param. so it prints println("Getting time in nanoseconds:") before printing println("Param : "+t)

提交回复
热议问题