When initializing multiple variables they are initialized in the order in which they are passed.
So if you are declaring first i
then j
, then the values 100000
then 5
are assigned in the same order.
When you print j
you will get 5
because it is the second variable and corresponds to the second value.
This also applies to the same way that multiple variable returns work in go, example below, or working example here in the playground.
func doStuff() (string, int) {
red, five := "red", 5
return red, five
}
See this helpful resource for more information on working with variables, and this from the Tour of Go on working with multiple variable returns.