Advertisement
cwchen

[Go] Iterating through a map.

Sep 23rd, 2017
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.25 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 k, v := range m {
  16.         fmt.Println(fmt.Sprintf("%s: %s", k, v))
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement