This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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