Go - Array

Card Puncher Data Processing

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)





Discover More
Card Puncher Data Processing
Go - (Package) main

in Go. Package main is special. It defines a standalone executable program, not a library. Reprint the argument. Os.Args is an array 0134190440Donovan, Alan, Kernighan, Brian W. - The...



Share this page:
Follow us:
Task Runner