<https://proandroiddev.com/kotlin-pearls-7-unit-no...
# feed
b
great article, just one small correction: You state that
null
has no type, but it’s type is
Nothing?
. You mention that later by saying that
Nothing?
as a return type forces you to return
null
. You can also verify this with this code
Copy code
val foo = null
println(::foo)
n
thanks! but i’m not the author 😅
b
Another thing I noticed is in this snippet:
Copy code
//Java
public static Consumer<Integer> printNum = x -> System.out.println("Num " + x);

//Kotlin
fun callMe(block: (Int) -> Unit): Unit = (1..100).forEach(block)

fun main(){
    callMe { Lambdas.printNum } //it works fine
}
nothing would happen because he's not actually passing in the function (and as far as I understand it won't compile). I believe the following was actually meant
Copy code
callMe(Lambdas::printNum) // it works fine