This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
.idea
|
.idea
|
||||||
boot-dev-pokedex
|
boot-dev-pokedex
|
||||||
|
*.log
|
||||||
22
main.go
22
main.go
@@ -1,13 +1,33 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
fmt.Println("Hello, World!")
|
quit := false
|
||||||
|
|
||||||
|
for !quit {
|
||||||
|
|
||||||
|
// read user input
|
||||||
|
input := bufio.NewScanner(os.Stdin)
|
||||||
|
fmt.Print("Pokedex > ")
|
||||||
|
for input.Scan() {
|
||||||
|
word := input.Text()
|
||||||
|
cleanedWord := cleanInput(word)
|
||||||
|
fmt.Printf("Your command was: %s\n", cleanedWord[0])
|
||||||
|
|
||||||
|
if cleanedWord[0] == "quit" {
|
||||||
|
quit = true
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user