Reputation: 13
I have 7 variables called averageMon
, averageTue
, averageWed
, and so on, and I need to compare the value stored in each variable to see which holds the highest value. I've been looking around but haven't found a way to do this. I'm brand new to this, and I'm sure this is a simple question, but any help would be appreciated. Thanks!
Upvotes: 1
Views: 61
Reputation: 28
If I understand correctly, just call the max function:
max(averageMon, averageTue, averageWed, averageThu, averageFri, averageSat, averageSun)
http://swift-ios.co/standard-functions-in-swift/
Upvotes: 1