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 dictionaryvar months = ["1" : "One","2" : "Two","3" : "Three","4" : "Four","5" : "Five","6" : "Six","7" : "Seven","8" : "Eight","9" : "Nine"]// Display dictionaryprint(months)// Get first entryprint(months.first!)
dictionary
instance called months
.first
property, then print it to the console.