有没有什么方法可以在 kotlin 中链接多个可空变量的多个 let?
fun example(first: String?, second: String?) {
first?.let {
second?.let {
// Do something just if both are != null
}
}
}
我是说,就像这样:
fun example(first: String?, second: String?) {
first?.let && second?.let {
// Do something just if both are != null
}
}