Skip to content

Instantly share code, notes, and snippets.

@rail-rate
Created August 13, 2019 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rail-rate/df428777e1c9445aa7f48183c8347ba9 to your computer and use it in GitHub Desktop.
Save rail-rate/df428777e1c9445aa7f48183c8347ba9 to your computer and use it in GitHub Desktop.
Map3
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