The first
property, when used on a dictionary
instance, returns the first key-value pair of the dictionary.
dictionary.first
The first entry of a dictionary in a key-value pair is returned.
// Create a dictionary var months = [ "1" : "One", "2" : "Two", "3" : "Three", "4" : "Four", "5" : "Five", "6" : "Six", "7" : "Seven", "8" : "Eight", "9" : "Nine" ] // Display dictionary print(months) // Get first entry print(months.first!)
dictionary
instance called months
.first
property, then print it to the console.RELATED TAGS
CONTRIBUTOR
View all Courses