RosettaCodeData/Task/Associative-array-Iteration/Kotlin/associative-array-iteration.kotlin

10 lines
284 B
Text
Raw Permalink Normal View History

2016-12-05 22:15:40 +01:00
fun main(a: Array<String>) {
val map = mapOf("hello" to 1, "world" to 2, "!" to 3)
with(map) {
2017-09-23 10:01:46 +02:00
entries.forEach { println("key = ${it.key}, value = ${it.value}") }
2016-12-05 22:15:40 +01:00
keys.forEach { println("key = $it") }
values.forEach { println("value = $it") }
}
}