Skip to content

Commit 80ff76e

Browse files
committed
banana
1 parent cceb574 commit 80ff76e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import s "github.com/Hcode00/simpleInput"
2525
To get a single input value, call the input function with a single prompt and retrieve the first element of the resulting slice:
2626

2727
```go
28-
name := s.input("Enter your name: ")[0] // John
28+
name := s.Input("Enter your name: ")[0] // John
2929
fmt.Printf("Hello %s.\n", name) // Hello John
3030
```
3131

@@ -34,7 +34,7 @@ fmt.Printf("Hello %s.\n", name) // Hello John
3434
To get multiple input values, call the input function with multiple prompts and retrieve the element
3535

3636
```go
37-
inputs := s.input("Enter your name: ", "Enter your age: ", "Enter your gender: ") // John 21 Male
37+
inputs := s.Input("Enter your name: ", "Enter your age: ", "Enter your gender: ") // John 21 Male
3838
name, age, gender := inputs[0], inputs[1], inputs[2] // name = "John" , age = "21" , gender = "Male"
3939
fmt.Printf("Hello %s, you are %s years old and you are a %s.\n", name, age, gender) //Hello John, you are 21 years old and you are a Male.\n
4040
```

simpleInput.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// input function takes in a variadic parameter of strings and returns a slice of strings.
1010
// It prompts the user to input values for each string in the parameter and stores them in the slice.
1111
// If no values are inputted, it returns nil.
12-
func input(str ...string) []string {
12+
func Input(str ...string) []string {
1313

1414
var Inputs []string
1515
scanner := bufio.NewScanner(bufio.NewReader(os.Stdin))

0 commit comments

Comments
 (0)