// Kotlin Collections Example // Source code file Collectons.kt // Create and read from an array // and a hash table. fun main(args: Array) { // Create an array and print its items. var a : Array = arrayOf(4, 2, 6, 9, 7) println(a[3]) println(a) // <-- Not useful. // Print using index. println( ) for(i in 0..4) { print(a[i].toString( ) + " ") } // For-each style. println( ) for(n in a) { print(n.toString( ) + " ") } // Create a hashmap and print its items. var h : HashMap = hashMapOf("name" to "Alice", "gender" to "F", "age" to "11") println( ) println(h) println(h["age"]) for((key, value) in h) { println("$key=$value") } }