Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

to and fro out of a loop to a method in back?

 
DANIEL GRESHAM
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a way to put a method call in a loop, so that once an array for this instance is incrimented, the program jumps to a method, finds a case in a flow control, jumps to another method completes a task and then jumps back to the loop itself? if so how would i do that or does jave do it itself do I need to include any return statements or anything i need to know before I try this action. and since this is a bit vague i will include some code

any help on this will be much appriciated.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34371
345
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daniel,
You are 99% there. You just need to call the method from the loop:

I didn't see the array update you mentioned (it may be there, I didn't read every line of code.) You could add this right before the call to command fetch.

Each time the loop executes, commandFetch() is called. That method calls the appropriate commandXXX() method. After the commandXXX() method is called, it returns to commandFetch(). As there is nothing left in commandFetch() to do, it returns control to the loop.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic