📅  最后修改于: 2022-03-11 15:01:00.104000             🧑  作者: Mango
var animals = ["cats", "dogs", "chimps", "moose"]
// remove at specific index
animals.remove(at: 2) //["cats", "dogs", "moose"]
// remove first element
animals.removeFirst() //["dogs", "moose"]
// remove last element
animals.removeLast() //["dogs"]
// remove at unknown index
if let index = animals.firstIndex(of: "dogs") {
animals.remove(at: index)
}