Skip to content

Instantly share code, notes, and snippets.

@gregworley
Created September 22, 2010 19:37
Show Gist options
  • Save gregworley/592344 to your computer and use it in GitHub Desktop.
Save gregworley/592344 to your computer and use it in GitHub Desktop.
// A version of echo - go/docs/GoCourseDay1.pdf slide 59
package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) < 2 { //length of array
os.Exit(1)
}
for i := 1; i < len(os.Args); i++ {
fmt.Printf("arg %d: %s\n", i, os.Args[i])
}
} // falling off end == os.Exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment