• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

y/n loops?

 
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:

 
Saloon Keeper
Posts: 10308
217
  • 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: 10308
217
  • 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?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!