takes a call-by-name parameter by putting the => symbol between the variable name and the type.
If you want to change selection, open document below and click on "Move attachment"
Scala Functions Call-by-Name Getting time in nano seconds")
System.nanoTime
}
def delayed( t: => Long ) = {
println("In delayed method")
println("Param: " + t)
t
}
}
Here, we declared the delayed method, which <span>takes a call-by-name parameter by putting the => symbol between the variable name and the type. When the above code is compiled and executed, it produces the following result:
C:/>scalac Test.scala
C:/>scala Test
In delayed method
Getting time in nano seconds
Param: 813038087
Summary
status
not read
reprioritisations
last reprioritisation on
suggested re-reading day
started reading on
finished reading on
Details
Discussion
Do you want to join discussion? Click here to log in or create user.