Können Sie sich vorstellen, was dieser Code in Swift bewirkt?
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
func secretFunction(of num: Int) -> Int { | |
if num == 1 { | |
return 1 | |
} else { | |
return num * secretFunction(of:num - 1) | |
} | |
} |
Und welches Ergebnis würden Sie für den folgenden Code sehen:
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
let x = 4 | |
let result = secretFunction(of: x) |
?
