Set array element at index

 Problem

I have an array and want to set a new value to one of its elements, by index.



 Recipe


// Initialize the Array
var arr = ["one", "two", "three"]

// Set element at index: 1
arr[1] = "TWO"

print(arr)

				

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)

 

 Playground