- Joined
- Dec 25, 2011
- Messages
- 5,470
- Reaction score
- 80
...on here?
Son is having trouble. Hes a VB'er so Java is new.
Wants a loop for a start that does so many iterations - he can do that.
Loop should stop without needing a break command then continue running the code?
It's a video clip or something that needs to loop "i" times then the rest of the code runs.
He's been looking. Said he's spent 5 hours on it (and he will have). From the very, very little I understand he can enter "play the video" as five separate commands and after the 5th time the rest of the code automatically runs. That's inelegant and inefficient. It's when he writes a single command that says "play the video 5 times" that everything just stops rather than continuing to run the rest of the code.
Hope that makes sense!
Someone else suggested:
int amount = 0;
boolean trip = false;
while (amount < 5 && !trip) {
/* Code in here to do what ever and set trip = false if you want to exit.
The exit can only happen at the end (as part of the start of) the loop */
amount++;
}
Son is having trouble. Hes a VB'er so Java is new.
Wants a loop for a start that does so many iterations - he can do that.
Loop should stop without needing a break command then continue running the code?
It's a video clip or something that needs to loop "i" times then the rest of the code runs.
He's been looking. Said he's spent 5 hours on it (and he will have). From the very, very little I understand he can enter "play the video" as five separate commands and after the 5th time the rest of the code automatically runs. That's inelegant and inefficient. It's when he writes a single command that says "play the video 5 times" that everything just stops rather than continuing to run the rest of the code.
Hope that makes sense!
Someone else suggested:
int amount = 0;
boolean trip = false;
while (amount < 5 && !trip) {
/* Code in here to do what ever and set trip = false if you want to exit.
The exit can only happen at the end (as part of the start of) the loop */
amount++;
}