/*------------------------------------------------------- * echo.go - echos the command line *------------------------------------------------------- * Demonstrates use of two packages fmt and os * Jim Fawcett, CSE775 - Distributed Objects, Spring 2016 *-------------------------------------------------------- */ package main import ( "fmt" // defines Println https://golang.org/pkg/fmt/ "os" // defines os.Args https://golang.org/pkg/os/ ) func main() { var s, sep string // declaring two strings for i := 1; i < len(os.Args); i++ { s += sep + os.Args[i] sep = " " // can use before definition } fmt.Println(s) }