Skip to content

Instantly share code, notes, and snippets.

@ezequieloliveiralima
Last active April 6, 2020 21:15
Show Gist options
  • Save ezequieloliveiralima/974d12ac151c8082bcae6e9c1ecb58e8 to your computer and use it in GitHub Desktop.
Save ezequieloliveiralima/974d12ac151c8082bcae6e9c1ecb58e8 to your computer and use it in GitHub Desktop.
struct Cachorro {
var nome: String
var raca: String
}
struct Pessoa {
var nome: String
var cachorros: [Cachorro]
}
func pessoa(pessoa: Pessoa, tem cachorro: Cachorro) -> Pessoa {
return Pessoa(nome: pessoa.nome, cachorros: pessoa.cachorros + [cachorro])
}
func latir(cachorro: Cachorro) {
print("\(cachorro.nome) latiu!")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment