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

10 lines
260 B
Text
Raw Permalink Normal View History

2024-03-06 22:25:12 -08:00
fun main() {
2023-07-01 11:58:00 -04:00
val map = mapOf("hello" to 1, "world" to 2, "!" to 3)
with(map) {
2024-03-06 22:25:12 -08:00
forEach { println("key = ${it.key}, value = ${it.value}") }
2023-07-01 11:58:00 -04:00
keys.forEach { println("key = $it") }
values.forEach { println("value = $it") }
}
}