-
-
Save fitomad/7998fe803d1d1109bf914303f7be8d46 to your computer and use it in GitHub Desktop.
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
/// Una función normal y corriente. | |
/// No devuelve nada | |
func returningFunction() -> Void | |
{ | |
print("returningFunction()") | |
} | |
/// Una función normal y corriente. | |
/// Devuelve una cadena de texto | |
func returningFunction(withParameter name: String) -> String | |
{ | |
return ("returningFunction(withParameter: \(name))") | |
} | |
/// Al llamar a esta función se dejan de | |
/// producir las llamadas al resto de código | |
/// que hubieras tras la llamada a esta función | |
func neverEndingFunction() -> Never | |
{ | |
fatalError("No voy a devolver el control") | |
} | |
// MARK: - Test - | |
returningFunction() | |
let text = returningFunction(withParameter: "Parametro") | |
print(text) | |
neverEndingFunction() | |
// Esto no se va a llamar nunca... | |
returningFunction() | |
let otherText = returningFunction(withParameter: "Parametro número 2") | |
print(otherText) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment