• Post Reply Bookmark Topic Watch Topic
  • New Topic

Having Trouble  RSS feed

 
Lee Seol
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi am having trouble with my program: My program stars the while loop again but it does not ask how many i would like the second time round please help:






 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Lee,

The below statements which you like to execute -


are all above and outside the while loop. Hence only the below statements which are present inside the while loop block (marked with open and a close brace) will be executed when the condition equals "Y"



Thanks! and welcome to JavaRanch!
 
Lee Seol
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Jai, thank you for the solution, but please always space and indent your code. Those if blocks compressed to a single line sans whitespace are very difficult to read.
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell,

since i just quote the code in original question i did not notice the congestion in the code. I will indent it properly henceforth!

thanks,
john
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My apologies; it wasn't your fault, and I didn't notice. Sorry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!