add: command-line arguments exercises
This commit is contained in:
@ -8,7 +8,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// EXERCISE
|
// EXERCISE: Count the Arguments
|
||||||
|
//
|
||||||
// Print the count of the command-line arguments
|
// Print the count of the command-line arguments
|
||||||
//
|
//
|
||||||
// INPUT
|
// INPUT
|
||||||
@ -19,9 +20,9 @@ package main
|
|||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// FIX THIS CODE
|
// UNCOMMENT & FIX THIS CODE
|
||||||
// count := ?
|
// 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)
|
// fmt.Printf("There are %d names.\n", count)
|
||||||
}
|
}
|
@ -8,9 +8,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// EXERCISE
|
// EXERCISE: Print the Path
|
||||||
// Print the path of the running program
|
//
|
||||||
// By getting it from `os.Args` variable
|
// Print the path of the running program by getting it
|
||||||
|
// from `os.Args` variable.
|
||||||
//
|
//
|
||||||
// HINT
|
// HINT
|
||||||
// Use `go build` to build your program.
|
// Use `go build` to build your program.
|
@ -8,8 +8,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// EXERCISE
|
// EXERCISE: Print Your Name
|
||||||
// Print your name
|
//
|
||||||
// Get it from the first command-line argument
|
// Get it from the first command-line argument
|
||||||
//
|
//
|
||||||
// INPUT
|
// INPUT
|
||||||
@ -20,12 +20,14 @@ package main
|
|||||||
//
|
//
|
||||||
// EXAMPLE
|
// EXAMPLE
|
||||||
// go run main.go inanc
|
// go run main.go inanc
|
||||||
// inanc
|
//
|
||||||
|
// inanc
|
||||||
//
|
//
|
||||||
// BONUS: Make the output like this:
|
// BONUS: Make the output like this:
|
||||||
|
//
|
||||||
// go run main.go inanc
|
// go run main.go inanc
|
||||||
// Hi inanc
|
// Hi inanc
|
||||||
// How are you?
|
// How are you?
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
|
||||||
func main() {
|
func main() {
|
@ -8,8 +8,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// EXERCISE
|
// EXERCISE: Greet More People
|
||||||
// Greet more people
|
|
||||||
//
|
//
|
||||||
// RESTRICTIONS
|
// RESTRICTIONS
|
||||||
// Be sure to match to the expected output below
|
// Be sure to match to the expected output below
|
@ -8,10 +8,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// EXERCISE
|
// EXERCISE: Greet 5 People
|
||||||
// Greeat 5 people this time.
|
//
|
||||||
// Do not copy paste from the previous exercise!
|
// Greet 5 people this time.
|
||||||
// And do not look at it.
|
//
|
||||||
|
// Please do not copy paste from the previous exercise!
|
||||||
//
|
//
|
||||||
// RESTRICTION
|
// RESTRICTION
|
||||||
// This time do not use variables.
|
// This time do not use variables.
|
11
06-variables/06-project-greeter/exercises/README.md
Normal file
11
06-variables/06-project-greeter/exercises/README.md
Normal 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)**
|
Reference in New Issue
Block a user