aspose file tools*
The moose likes Beginning Java and the fly likes Ending a loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Ending a loop

Joey McGee
Greenhorn

Joined: Nov 22, 2012
Posts: 27
Below is the code where I've created a loop and am trying to code it to end if the user types in no... If anyone could help me with this it would be greatly appreciated.
Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 186
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

break statement would do the job, of course in your case combined with proper check for user input.


The quieter you are, the more you are able to hear.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38363
    
  23
If you are going to have that do‑while loop, you are far better writing it like thisYou will have to check whether answer is still in scope if it is declared inside the loop.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ending a loop