Introduction
The purpose of this challenge is to practice working with command-line arguments in Golang.
This tutorial is from open-source community. Access the source code
The purpose of this challenge is to practice working with command-line arguments in Golang.
The program currently prints out the raw command-line arguments passed to it. However, it needs to be modified to print out specific arguments based on their index.
## To experiment with command-line arguments it's best to
## build a binary with `go build` first.
$ go build command-line-arguments.go
$ ./command-line-arguments a b c d
[./command-line-arguments a b c d]
[a b c d]
c
## Next we'll look at more advanced command-line processing
## with flags.
In this challenge, we learned how to access and print out specific command-line arguments in Golang. By using the os.Args
variable and indexing into it, we can easily access the arguments passed to the program.