Contact: aviboots(AT)netvision.net.il
39,884 questions
51,810 answers
573 users
import Foundation var arr = [1, 2, 3, 4, 5, 6] arr.remove(at: 2) // Remove the element at index 2 print(arr) /* run: [1, 2, 4, 5, 6] */
import Foundation var arr = [1, 2, 3, 4, 5, 6] // Remove the element by value if let index = arr.firstIndex(of: 3) { arr.remove(at: index) } print(arr) /* run: [1, 2, 4, 5, 6] */