Re:Why nullable types?
by mmis1000 on Tuesday December 08, 2020 @08:48PM
(#25354379)
That is where you use optional chaining + extension method. And that is basically identical to Optional.map or whatever method in those language with Optional type
in kotlin
func add3 (val: Int?) = val ?.let { it + 3 }
The language gives you a way to say: `this value plus 3 if it exist or just return null`
Unfortunately, there is no such method in js currently, so it looks half baked.
in kotlin
The language gives you a way to say: `this value plus 3 if it exist or just return null`Unfortunately, there is no such method in js currently, so it looks half baked.