Skip to content

Instantly share code, notes, and snippets.

@gabrielPeart
Created March 17, 2016 12:25
Show Gist options
  • Save gabrielPeart/c1f61f1ec88e1da734b4 to your computer and use it in GitHub Desktop.
Save gabrielPeart/c1f61f1ec88e1da734b4 to your computer and use it in GitHub Desktop.
extension Int {
var add: Int {return self + 100 }
var sub: Int { return self - 10 }
var mul: Int { return self * 10 }
var div: Int { return self / 5 }
}
let addition = 3.add
println("Addition is \(addition)")
let subtraction = 120.sub
println("Subtraction is \(subtraction)")
let multiplication = 39.mul
println("Multiplication is \(multiplication)")
let division = 55.div
println("Division is \(division)")
let mix = 30.add + 34.sub
println("Mixed Type is \(mix)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment