Hi guys so I am still learning and there might be an easier way to do thing than how i do them but still i need some help. So I was thinking of making a program in which it asks you a question , lets say Yes/No question and you have to enter the answer.So its should be goood while the person enters Yes or No but I want some way to make the program return to the start of the question if the person just enters something random lets say Potato :D. And my idea was to make a program with Do While and to enter the condition to be something like if X is not Yes/No redo the whole thing , if it is come out of the algorithm and maybe ill add an If to get different answers for yes or no. So how do I do the do while NOT thing and is it even possible. I hope you can understand my logic and thanks in advance :)
Jump to Post
Perhaps a switch -- case statement will do the trick here.
case "Yes" do this
case "No" do that
case something else: handle default
All 5 Replies
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.