Skip to content

Instantly share code, notes, and snippets.

@lucianoschillagi
Created January 15, 2018 14:33
Show Gist options
  • Save lucianoschillagi/39bce4121cfdc6d715de7b62a555d5e0 to your computer and use it in GitHub Desktop.
Save lucianoschillagi/39bce4121cfdc6d715de7b62a555d5e0 to your computer and use it in GitHub Desktop.
Pasa valores a través de funciones
func teLosDoy() {
necesitoDosNumerosParaMultiplicar(n1: 4, n2: 7) // pasa los argumentos a la func 'necesitoDosNumerosParaMultiplicar'
}
func necesitoDosNumerosParaMultiplicar(n1: Float, n2: Float) {
let resultado = n1 * n2
imprimoElResultado(queEs: "\(resultado)") // pasa los argumentos a la func 'imprimoElResultado'
}
func imprimoElResultado(queEs: String) {
print("El resultado es \(queEs)")
}
teLosDoy() // prints 'El resultado es 28.0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment