Weekly Puzzle#2: Guess, what this code does?

Can you guess what this code in Swift does?

func secretFunction(of num: Int) -> Int {
if num == 1 {
return 1
} else {
return num * secretFunction(of:num - 1)
}
}

And what result would you see for the code below:
let x = 4
let result = secretFunction(of: x)
?

Tags: