DEV Community

Discussion on: Daily Challenge #119 - Adding Big Numbers

Collapse
 
kesprit profile image
kesprit

Swift function :

func sum(first: String, second: String) -> String {
    return "\((Int(first) ?? 0) + (Int(second) ?? 0))"
}

And with a closure :

let _ = { (first: String, second: String) -> String in
    "\((Int(first) ?? 0) + (Int(second) ?? 0))"
}
Collapse
 
idanarye profile image
Idan Arye

Isn't Int a sized integer? It won't work with numbers that don't fit in 64 bits (or 32 bits, if you compile it for 32 bit architectures)