package main
func f(n int) (r int) {
a, r := n-1, n+1
if a+a == r {
c, r := n, n*n
r = r - c
}
return r
}
func main() {
println(f(3))
}
Choices:
Answer: 4
Run it on Go play.
Key point:
r
varialbe declared in the inner block is not a re-declaration of the one (the return result) declared in the function top block.
It is totally a new declared variable.
So the return result is not modified in the inner block.