fun main() { val maybe: String? = "data" // the block runs only if maybe is not null maybe?.let { println("got $it of length ${it.length}") } }
run a block only when non-null