Created
August 13, 2019 11:15
-
-
Save rail-rate/df428777e1c9445aa7f48183c8347ba9 to your computer and use it in GitHub Desktop.
Map3
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 main(args: Array<String>) { | |
val a : MutableMap<Int, String> = mutableMapOf(1 to "ねこ") | |
a.put(2 , "いぬ") //追加 | |
println("${a[1]} ${a[2]}") //そのまま表示 | |
a.remove(1) //ここで「ねこ」を削除 | |
val a1 = a[1] //キーに新しい変数を付ける | |
val a2 = a[2] //同様 | |
println(a1 +" " + a2) //変数での表示方法 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment