Advertisement
cwchen

[Go] Map doesn't guarantee its order.

Sep 23rd, 2017
570
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.30 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5. )
  6.  
  7. func main() {
  8.     m := make(map[string]string)
  9.  
  10.     m["Go"] = "Beego"
  11.     m["Python"] = "Django"
  12.     m["Ruby"] = "Rails"
  13.     m["PHP"] = "Laravel"
  14.  
  15.     for i := 0; i < 10; i++ {
  16.         for k, v := range m {
  17.             fmt.Println(fmt.Sprintf("%s: %s", k, v))
  18.         }
  19.  
  20.         fmt.Println("")
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement