From c309fe0fdf02e2309e78ec15eb72373e66896b2c Mon Sep 17 00:00:00 2001 From: Eric Sans Date: Wed, 3 Jul 2019 02:45:30 +0200 Subject: [PATCH] Add style and correct syntax (#22444) Should the function names be kept in English, since it's the language developers will use for their apps? Maybe the data inside the vars can be in Spanish. --- guide/spanish/swift/functions/index.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/guide/spanish/swift/functions/index.md b/guide/spanish/swift/functions/index.md index 62e34bbb88..4b2df13311 100644 --- a/guide/spanish/swift/functions/index.md +++ b/guide/spanish/swift/functions/index.md @@ -4,12 +4,24 @@ localeTitle: Funciones --- ## Funciones -Las funciones en Swift consisten en un parámetro y un tipo de retorno. Las funciones se pueden crear utilizando esta estructura básica: \`\` \`Swift func sayHello (nameOfPerson: String) -> String { let hola = "Hola," + nameOfPerson + "." imprimir (hola) } +Las funciones en Swift consisten en un parámetro y un tipo de retorno. Las funciones se pueden crear utilizando esta estructura básica: + ```Swift + func sayHello(nameOfPerson: String) -> String { + let hello = "Hola," + nameOfPerson + "." + print(hello) + } -sayHello (nameOfPerson: "Steve") ` `` In this example, the function sayHello takes in a string name and prints out the phrase` "Hola, Steve". + sayHello(nameOfPerson: "Steve") + ``` +En este ejemplo, la función sayHello coge una cadena de palabras e imprime la frase `"Hola, Steve."`. ## Parámetros de función -Las funciones no requieren ningún parámetro de entrada o tipo de retorno. Sin embargo, esto requiere los paréntesis después de nombrar las funciones. \`\` \`Swift func helloSteve () { imprimir ("Hola, Steve") } - -helloSteve () // Esto imprime "Hola, Steve". \`\` \` \ No newline at end of file +Las funciones no requieren ningún parámetro de entrada o tipo de retorno. Sin embargo, esto requiere los paréntesis después de nombrar las funciones. + ```Swift + func helloSteve() { + print("Hola, Steve.") + } + + helloSteve() // Esto imprime "Hola, Steve." + ```