Closed GoogleCodeExporter closed 9 years ago
This confused me, too! I had to look at the code for a while before I figured
it out what was going on. What's tricky here is that the functions are being
called as params to a print function. Here's the code:
fmt.Println(
pow(3, 2, 10),
pow(3, 3, 20),
)
First, pow(3, 2, 10) runs. That runs the print statement in the pow function
(27 >= 20). It also returns lim.
Next pow(3, 3, 20) runs. That returns v.
Now that both pow functions have returned, the print in the main function runs
and prints lim and v (9 20).
Hope that helps.
Original comment by kbris...@google.com
on 7 May 2014 at 11:02
Original comment by a...@golang.org
on 8 May 2014 at 3:18
Original issue reported on code.google.com by
feedback...@gmail.com
on 14 Aug 2013 at 7:13