How To Get Array Element At Index | iSwift Cookbook

Comments · 542 Views

Learn how to get array element at index in Iswift cookbook

“To get a particular element at a specific index of an array, we may use its subscript.


// First, we initialize a test array

let arr = ["one", "two", "three"]

// We want the item at index: 1

let item = arr[1]

// Let's see...

print("Item at index 1: \(item)")
Item at index 1: two”

Comments