Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fun using_with() {
val stringBuilder = StringBuilder()
stringBuilder.append("Hello")
stringBuilder.append(", Kotlin!")
print(stringBuilder.toString())
}
fun using_also(a: Int): Int {
val b = a * 10
if (b > 100) print(">100")
return b
}
fun using_apply(): java.util.Properties {
val properties = java.util.Properties()
properties.setProperty("key", "value")
return properties
}
fun using_let(p: java.util.Properties?, key: String) {
if (p != null) print(p.getProperty(key))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment