@SymphOmni It seems you didn't understand the goal of the exercise ?
The purpose is to let you discover through practice the basic Swift concepts. In the case the dictionaries, a very important type in Swift.
Here you may have noted that interestingNumbers is a dictionary: a series of entries, which are pairs called key (a string) and value (here an array), such as "Prime": [2, 3, 5, 7, 11, 13]
The example shows that in the for loop, you explore the dictionary but don't need to know what the key is (because you don't use).
as dark-as showed, if you need to use the key, change _ into a name as dataset, or key, or whatever you want.
In another exercise, you could also iterate over the dictionary like this:
let interestingNumbers = [
"Prime": [2, 3, 5, 7, 11, 13],
"Fibonacci": [1, 1, 2, 3, 5, 8],
"Square": [1, 4, 9, 16, 25]
]
var largest = 0
var largestSet = ""
for aLine in interestingNumbers { // get entries of dictionary as a whole
for number in aLine.value { // value is the array, for each entry line
if number > largest {
largest = number
largestSet = aLine.key // The key (the name) of the entry line
}
}
}
print (largest, "in", largestSet)
More difficult to read, but exactly the same result.
25 in Square
Exercise yourself by finding the smallest…