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
import Foundation | |
extension Int | |
{ | |
/** | |
Y puedes añadirlo en una extensión de tipo | |
*/ | |
public mutating func callAsFunction(_ sumando: Int) -> Int | |
{ | |
self += sumando | |
return self | |
} | |
} | |
// | |
// TEST | |
// | |
var edad = 34 | |
edad(10) // Ahora vale 44 | |
print("Edad \(edad)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment