Skip to content

Instantly share code, notes, and snippets.

@dev4dev dev4dev/wat.swift
Last active Mar 1, 2018

What would you like to do?
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.