# Removes an element from the given map and returns a new map without that element
RemoveKeyFromMap(ExampleMap:[string]int, ElementToRemove:string):[string]int=
var NewMap:[string]int = map{}
# Concatenate Keys from ExampleMap into NewMap, excluding ElementToRemove
for (Key -> Value : ExampleMap, Key <> ElementToRemove):
set NewMap = ConcatenateMaps(NewMap, map{Key => Value})
return NewMap
mapのキーをplayerにした場合
型をplayerに変更する。
RemoveKeyFromMap(ExampleMap:[player]int, ElementToRemove:player):[player]int=
var NewMap:[player]int = map{}
for (Key -> Value : ExampleMap, Key <> ElementToRemove):
set NewMap = ConcatenateMaps(NewMap, map{Key => Value})
return NewMap
コメント