13 lines
187 B
Text
13 lines
187 B
Text
|
|
//Static method on a built-in type Integer
|
||
|
|
static func Integer.Div(x, y) {
|
||
|
|
x / y
|
||
|
|
}
|
||
|
|
|
||
|
|
//Instance method
|
||
|
|
func Integer.Div(n) {
|
||
|
|
this / n
|
||
|
|
}
|
||
|
|
|
||
|
|
print(Integer.Div(12, 3))
|
||
|
|
print(12.Div(3))
|