Last active
April 7, 2020 23:45
-
-
Save Fitranugraha/04516402feb88daaf6aed6fd4236f06e to your computer and use it in GitHub Desktop.
Kotlin Syntax Should Remember
This file contains hidden or 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 main(){ | |
val allBooks = setOf("Macbeth", "Romeo and Juliet", "Hamlet", "A Midsummer Night's Dream") | |
val library = mapOf("Shakespeare" to allBooks) | |
println(library.any { it.value.contains("Hamlet") }) | |
val moreBooks = mutableMapOf<String, String>("Wilhelm Tell" to "Schiller") | |
moreBooks.getOrPut("Jungle Book") { "Kipling" } | |
moreBooks.getOrPut("Hamlet") { "Shakespeare" } | |
println(moreBooks) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment