Eliminar un valor de un array en un indice especifico / Removing a value from a specific index

var animalArray: [String] = ["Dog", "Cat", "Fish", "Owl", "Beaver"] animalArray.removeAtIndex(4) //animalArray now contains: ["Dog", "Cat", "Fish", "Owl"] /*Alternately, if you wish to save the value before you remove it:*/ let stringAnimal = animalArray.removeAtIndex(4) //Saves "Beaver" to the string constant stringAnimal and also removes it from the array.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.