• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Do/While and If/Else statement help/confusion

 
Reno Madrigal
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again, I am having quite a bit of confusion with these statements; here is what my program statment looks like.



I really think I have possibly overused the "{}". But my main problem is configuring the do/while loops and the if/else statments inside them, to me its confusing. Thanks a ton for any pointers or direction.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34965
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've added some indentation to show which braces go with what. It's not that you have too many. It's that they aren't in the correct places in terms of matching up.

While technically the if/else doesn't require braces (because they only contain one statement), it is still good practice to have them there. If someone adds a statement in the future, they will thank you!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic