Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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