//var myArray = [] - sign when we are talking about arrays
var myStringArray = ["Apple", "Mango", "Grapes"]
var myArray = [12, 10, 5, 7]
var arr: [Int] = [1, 3, 5]
print(myArray.count) //how many items inside the array
print(myyArray[0])
print("my array count is \(myArray.count)")
//Append (add to existing array at the end)
myStringArray.append("Bread")
myStringArray += ["Hello"]
myArray += [57]
//Insert (add a new value inside a specific index, and move 1 position the above items)
myStringArray.insert("New value", atIndex: 0)
// you can combine different types inside the same array
var newArr = [1, 2.3, "hi"]
//empty array
var emptyArr:[int]
//Remove items
myStringArray.removeAtIndex(2)
//Remove Last (remove the last item)
myStringArray.removeLast()
//Remove range
myArr,removeRange(1...2)
Categories: Iphone Swift 3