-
-
Save gabrielPeart/c1f61f1ec88e1da734b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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