Help with a CLI calculator (Go)
Go to solution
Solved by Sauron,
No offense but that for loop at the end is a mess
Why not something like this
import "strings" ... for { ... //your code before the final loop var run = false for { fmt.Scan(&resume) var low_resume = strings.ToLower(resume) if low_resume == "y" || low_resume == "yes" { run = true break } else if low_resume == "n" || low_resume == "no" { break } else { fmt.Println("Invalid input, try again - would you like to repeat the process? [y/n]") } } if !run { break } }
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now