• Post Reply Bookmark Topic Watch Topic
  • New Topic

y/n loops?  RSS feed

 
Jacob Smithenson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello! I've got an assignment to take this code (done for a previous assignment, you insert a starting number, upper bound, and step size, and it provides a list of numbers) and put it into a loot that at the end asks you if you'd like to do it again, and entering a y starts over (obviously) and n ends the program. I have absolutely no idea how to make y continue it. I understand that something boolean would make the most sense, but I'm only about a week and a half into the course so I really have no idea other than that.( Also, it is supposed to prompt an error message if the upper bound is lower than the starting number). Here is the code:

 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch, Jacob!

So, you want to repeat the program while the user finishes one repetition with a "y"?
 
Jacob Smithenson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want it to complete the first run through, then prompt them with the y/n message, and then if yes it'll repeat the run through (and ask for all the info again).
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So do you know of ways to make a certain piece of code run multiple times?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!