• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

y/n loops?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
Bartender
Posts: 15741
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 15741
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic