add: command-line arguments exercises

This commit is contained in:
Inanc Gumus
2018-10-27 16:27:36 +03:00
parent 66e6d7d01b
commit 1a21064e7d
11 changed files with 32 additions and 17 deletions

View File

@ -8,7 +8,8 @@
package main
// ---------------------------------------------------------
// EXERCISE
// EXERCISE: Count the Arguments
//
// Print the count of the command-line arguments
//
// INPUT
@ -19,9 +20,9 @@ package main
// ---------------------------------------------------------
func main() {
// FIX THIS CODE
// UNCOMMENT & FIX THIS CODE
// count := ?
// UNCOMMENT IT FIRST, THEN DO NOT TOUCH THIS CODE
// UNCOMMENT IT & THEN DO NOT TOUCH THIS CODE
// fmt.Printf("There are %d names.\n", count)
}

View File

@ -8,9 +8,10 @@
package main
// ---------------------------------------------------------
// EXERCISE
// Print the path of the running program
// By getting it from `os.Args` variable
// EXERCISE: Print the Path
//
// Print the path of the running program by getting it
// from `os.Args` variable.
//
// HINT
// Use `go build` to build your program.

View File

@ -8,8 +8,8 @@
package main
// ---------------------------------------------------------
// EXERCISE
// Print your name
// EXERCISE: Print Your Name
//
// Get it from the first command-line argument
//
// INPUT
@ -20,9 +20,11 @@ package main
//
// EXAMPLE
// go run main.go inanc
//
// inanc
//
// BONUS: Make the output like this:
//
// go run main.go inanc
// Hi inanc
// How are you?

View File

@ -8,8 +8,7 @@
package main
// ---------------------------------------------------------
// EXERCISE
// Greet more people
// EXERCISE: Greet More People
//
// RESTRICTIONS
// Be sure to match to the expected output below

View File

@ -8,10 +8,11 @@
package main
// ---------------------------------------------------------
// EXERCISE
// Greeat 5 people this time.
// Do not copy paste from the previous exercise!
// And do not look at it.
// EXERCISE: Greet 5 People
//
// Greet 5 people this time.
//
// Please do not copy paste from the previous exercise!
//
// RESTRICTION
// This time do not use variables.

View File

@ -0,0 +1,11 @@
# Command Line Arguments
1. **[Count the Arguments](https://github.com/inancgumus/learngo/tree/master/06-variables/06-project-greeter/exercises/01-count-arguments)**
2. **[Print the Path](https://github.com/inancgumus/learngo/tree/master/06-variables/06-project-greeter/exercises/02-print-the-path)**
3. **[Print Your Name](https://github.com/inancgumus/learngo/tree/master/06-variables/06-project-greeter/exercises/03-print-your-name)**
4. **[Greet More People](https://github.com/inancgumus/learngo/tree/master/06-variables/06-project-greeter/exercises/04-greet-more-people)**
5. **[Greet 5 People](https://github.com/inancgumus/learngo/tree/master/06-variables/06-project-greeter/exercises/05-greet-5-people)**