Apple\'s newly released language Swift has an example on the official documentation. Example is like this;
let interestingNumbers = [
\"Prime\": [2, 3, 5, 7,
However, I can't seem to figure out what is "(kind,numbers)" here represent
The loop iterates over the dictionary, and every iteration gives you a key and associated value. Those are called kind
(key) and numbers
(value) here. You can choose any name you want.
and how should I make my for-loop to go through all Dictionary(interestingNumbers) keys and find which key has the largest number.
You get each key in turn in the kind
loop variable.
Once you find one that results in a new largest
, you can assign that to a result variable, say largestKind
.
At the end of the loop, largestKind
will contain the key of the array with the largest number (that number being the largest
you already have).