'Sort a dictionary using an the value and an if statement
I am new to Swift and I am trying to go out on my own and create my own "app." I am creating an "app" that I can take a dictionary of players:ranking and sort them into three tiers based on the ranking. I keep getting errors and cannot figure out why. I searched through Stack Overflow and other documentation and still can't figure it out.
Any help would be greatly appreciated!
Solution 1:[1]
playerValues is an array of values. You cant expect to compare it to an Int
Try
for person in playerKey {
if player[person] > 1035 {
tierA.append(person)
} else if player[person] > 1021 {
tierB.append(person)
} else {
tierC.append(person)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Swarnendu Basak |
