Skip to content

Commit

Permalink
:q to quit
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangbits committed Jun 2, 2020
1 parent ae56a59 commit a1df609
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion c1-m2-activity/findian.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ a in between
func main() {
for {
var findString string
fmt.Printf("Please input a string: ")
fmt.Printf("Please input a string(input ':q' to quit): ")
num, err := fmt.Scan(&findString)
if err != nil {
fmt.Printf(err.Error() + string(num))
Expand All @@ -24,6 +24,10 @@ func main() {
if findian(findString) {
fmt.Printf("Found!\n")
} else {
if findString == ":q" {
fmt.Printf("Bye!\n")
break
}
fmt.Printf("Not Found!\n")
}
}
Expand Down

0 comments on commit a1df609

Please sign in to comment.