Value Definitions and Termination
The difference between val and def becomes apparent when the right hand side does not terminate.Given
def loop: Boolean = loop
A definition
def x = loop
is OK, but a definition
val x = loop
will lead to an infinite loop.
Ввійдіть щоб вподобати
Ввійдіть щоб прокоментувати