Created
March 30, 2017 22:35
-
-
Save EdenShapiro/884b17a86d071b7e446b6c1ffc69b394 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sumAll(objs: Any...) -> Int { | |
var sum = 0 | |
for object in objs { | |
if let num = object as? Int { | |
sum += num | |
} else if let str = object as? String { | |
if let num = Int(str){ | |
sum += num | |
} | |
} | |
} | |
return sum | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment