Arrays Flashcards
How do you declare an Array?
With Square-Brackets
How do you find out how many items are in an Array?
[“nameOfArray”].count
How do you append an Element to an exsisting Array?
[“nameOfTheArray”].append()
How do you remove the last Element of an Array?
array.removeLast()
How do you sort the Elements of an Array?
array.sort()
How do you remove an Element of an Array at a specific Index?
array.removeAtIndex()
How do you remove the first Element of an Array?
array.removeFirst()
How do you remove all Elements of an Array?
array.removeAll()
What is a Dictionary?
A dictionary stores associations between keys of the same type and values of the same type in a collection with no defined ordering
How do you create a Dictionary?
[“key_Name”:”key_Value”]
How do you access the Value of an Element in the dictionary?
[nameOfDictionary][“key_Name”]
How do you count the Elements of a Dictionary?
[dictionary_Name].count
How do you append an Element to a Dictionary?
[dictionary_Name][“key_Name”] = [“key_Value”]
How do you remove an Elemt of a Dictionary?
[dictionary_Name].removeValueForKey(“[key_Name]”)