Go - Array

Snippet

Loop (Range)

In each iteration of the loop, range produces a pair of values:

  • the index
  • and the value of the element at that index.

Example: print of the main argument.

s, sep := "", ""
for _, arg := range os.Args[1:] {
	s += sep + arg
	sep = " "
}
fmt.Println(s)

Powered by ComboStrap