Skip to content

Instantly share code, notes, and snippets.

@lamarmarshall
Created October 15, 2017 00:51
Show Gist options
  • Save lamarmarshall/ff5833591292a1c57acb46676a586162 to your computer and use it in GitHub Desktop.
Save lamarmarshall/ff5833591292a1c57acb46676a586162 to your computer and use it in GitHub Desktop.
golang loops, arrays and maps
package main
import (
"fmt"
)
func main() {
for i := 1; i <= 10; i++ {
fmt.Printf("%v -- %v \n", "super", "love")
}
x := []int{1, 2, 3, 4, 85, 6, 7}
for index, value := range x {
fmt.Printf("%d-%d,", index, value)
}
name := make(map[string]string)
name["lamar"] = "marshall"
name["mary"] = "carter"
name["china"] = "hill"
for first, last := range name {
fmt.Printf("%v %v\n", first, last)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment