I've been going through the "Tour of Go" found at
http://tour.golang.org and the example about
if on page 21 of the offline version (
Edit: it's #22 in the online version) just has me scratching my head. Can't reconcile the output with what I think is the order of execution here.
Output when I run this is listed below. Why did "27 >= 20" get printed first? I expected it to be 9 because of line 5.
To add to my confusion, if I flip the order of the parameters to fmt.Println on lines 15 and 16, the output is
Notice how only 20 and 9 got flipped. I was expecting "9 20" to be the first line in the output, then "27 >= 20" but that didn't happen.
And if I remove the last comma on line 16, the one after the second parameter to fmt.Println, I get a compiler error:
syntax error: unexpected semicolon or newline, expecting
Any help in grokking the order of execution would be greatly appreciated.