Given the following definition
def loop: Boolean = loop
which options will result in an infinite loop?
The def form is "by-name", its right hand side is evaluated on each use. The is also a val form, which is "by-value" The right-hand side of val definition is evaluated at the point of the definition itself. Afterwards, the name refers to the value.
Source: Conditionals and Value Definitions

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback