concept Some in category kotlin

This is an excerpt from Manning's book Functional Programming with Kotlin.
defined, in which case it will be a Some

This is an excerpt from Manning's book The Joy of Kotlin.
This example prints nothing and will directly throw an exception because Kotlin is a strict language. Function parameters are evaluated before the function is executed, whether they’re needed or not. This means the
getOrElsefunction parameter is evaluated in any case, whether it’s called on aSomeor aNone. The fact that the function parameter isn’t needed for aSomeis irrelevant. This makes no difference when the parameter is a literal, but it makes a huge difference when it’s a function call. ThegetDefaultfunction will be called in any case, so the first line will throw an exception and nothing will be displayed. This is generally not what you want.