Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#Actualepicpunnum

Posted 19 February 2013 - 11:36 AM

First and foremost, because you declare isfin as false and then go straight into your loop, the body of your loop will only run once every time, so you really have no need for your loop. Secondly,  within your do-while, you need a statement that can change the value of your boolean isfin. Otherwise, if isfin is true, your program will loop endlessly, even if NSplitFrame is past your limits.

Now I don't know what you're using NSplitFrame for, but there are multiple ways of preventing your ArrayOutOfBoundsException. In most cases, if you're iterating through an array, it is recommended that you use a loop - usually a for loop. However, any loop can be written as any other loop (for, while, do-while).
 

If you can clarify what you're trying to do with your loop, I can be of a bit more help.


#1epicpunnum

Posted 19 February 2013 - 11:36 AM

First and foremost, because you declare isfin as false and then go straight into your loop, the body of your loop will only run once every time, so you really have no need for your loop. Secondly,  within your do-while, you need a statement that can change the value of your bool isfin. Otherwise, if isfin is true, your program will loop endlessly, even if NSplitFrame is past your limits.

Now I don't know what you're using NSplitFrame for, but there are multiple ways of preventing your ArrayOutOfBoundsException. In most cases, if you're iterating through an array, it is recommended that you use a loop - usually a for loop. However, any loop can be written as any other loop (for, while, do-while).
 

If you can clarify what you're trying to do with your loop, I can be of a bit more help.


PARTNERS