I'm looking to iterate through 2 different maps, and have them output on a side by side basis like
foo --------- bar zoo--------- car
The problem stems from not being able to properly use 2 maps, although I dont have to use maps. the order of index doesnt matter but the key pair values must stay the same, so in this instance, zoo must be with car, but doesnt neccessarily have to be NEXT to foo bar,
for k, z := range teamA {
fmt.Fprintln(w, k+" "+z)
}
for k, z := range teamB {
fmt.Fprintln(w, k+" "+z)
}
But the error with this approach is it prints out all lines (each map has 5 values, so 10 lines total) in a block format like below, not side by side as i wish. How can I get it to print side by side? not like the block below
foo --- bar
zoo ------------ car
question from:
https://stackoverflow.com/questions/65833004/iterating-through-2-maps-preserving-order-on-same-line-output 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…