KOTLIN_LIB Telegram 436
if vs let” в Kotlin


Что использовать для объектов nullable-типа в Kotlin: if или let?

Давайте начнем с проблемы:


class IfOrLet {

private var string1: String? = "some string 1"

init {
if(string1 != null) {
makeString1Null()
println(string1) // prints null
}
}

private fun makeString1Null() {
string1 = null
}

}


https://medium.com/@khush.panchal123/if-vs-let-in-kotlin-3370077de55d

✍️ @kotlin_lib
👍41



tgoop.com/kotlin_lib/436
Create:
Last Update:

if vs let” в Kotlin


Что использовать для объектов nullable-типа в Kotlin: if или let?

Давайте начнем с проблемы:


class IfOrLet {

private var string1: String? = "some string 1"

init {
if(string1 != null) {
makeString1Null()
println(string1) // prints null
}
}

private fun makeString1Null() {
string1 = null
}

}


https://medium.com/@khush.panchal123/if-vs-let-in-kotlin-3370077de55d

✍️ @kotlin_lib

BY Kotlin




Share with your friend now:
tgoop.com/kotlin_lib/436

View MORE
Open in Telegram


Telegram News

Date: |

A vandalised bank during the 2019 protest. File photo: May James/HKFP. You can invite up to 200 people from your contacts to join your channel as the next step. Select the users you want to add and click “Invite.” You can skip this step altogether. Telegram desktop app: In the upper left corner, click the Menu icon (the one with three lines). Select “New Channel” from the drop-down menu. Those being doxxed include outgoing Chief Executive Carrie Lam Cheng Yuet-ngor, Chung and police assistant commissioner Joe Chan Tung, who heads police's cyber security and technology crime bureau. How to create a business channel on Telegram? (Tutorial)
from us


Telegram Kotlin
FROM American