• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Looping a switch statement?

 
Albert Richards
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I have a system where a user can order some predefined items. To do this, I have been using a switch statement, e.g:



However, once i've reached the end of the individual cases, I would like them to repeat, so the user could buy more than one item at once, and have this added to an array list. I think I have the array worked out, but the loop is proving problematic. I understand that the code below is one way I can do it, but I don't know how to increase the counter so the statement can loop properly.

Can anyone please help? Thanks



 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You *are* increasing the counter: i++.
 
Moguluri Ravi Kiran
Ranch Hand
Posts: 63
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this logic may help you..


 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic