RosettaCodeData/Task/Command-line-arguments/Go/command-line-arguments.go

16 lines
227 B
Go

package main
import (
"fmt"
"os"
)
func main() {
for i, x := range os.Args {
if i == 0 {
fmt.Printf("This program is named %s.\n", x)
} else {
fmt.Printf("the argument #%d is %s\n", i, x)
}
}
}