Skip to content

Instantly share code, notes, and snippets.

@EdenShapiro
Created March 30, 2017 22:35
Show Gist options
  • Save EdenShapiro/884b17a86d071b7e446b6c1ffc69b394 to your computer and use it in GitHub Desktop.
Save EdenShapiro/884b17a86d071b7e446b6c1ffc69b394 to your computer and use it in GitHub Desktop.
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