Skip to content

Instantly share code, notes, and snippets.

@dev4dev
Last active March 1, 2018 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dev4dev/5128f227e11fa440955b3023a169e30a to your computer and use it in GitHub Desktop.
Save dev4dev/5128f227e11fa440955b3023a169e30a to your computer and use it in GitHub Desktop.
let a = "13"
let b = "13a"
if let a = Int(a), let b = Int(b) {
let result = a + b
print(result) // will print only if b is correct number
} else {
print("fuck you spilberg")
}
let result = (Int(a) ?? 0) + (Int(b) ?? 0)
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment