Exercise: Deduce the Outputs
In this lesson, your concepts will be evaluated through a quiz.
Choose one possible correct answer.
1
What is the outcome of a program calling the recursive function f
with value 5?
func f(n int) {
defer func() { fmt.Println(n) }()
if n == 0 {
panic(0)
}
f(n-1)
}
A)
0
1
2
3
4
5
B)
5
4
3
2
1
0
C)
Throws a panic
D)
Both A and C
Question 1 of 30 attempted
Get hands-on with 1400+ tech skills courses.