Hi @TeaPod! Could you please post a bit of your code so that we can find any bugs in it? Thanks!
But for starters, you should check your restrictions on how your for-loop should run. for example:
for (int i = 0; i <= -5; i--){
println(i); // I want it to print number from 0 to -5
}
The above code will not run once because the conditions i <= -5 will never be met (the starting case,0, is greater than -5) and so the code in the for loop won't be executed
Instead I should do this
for (int i = 0; i >= -5; i--){
println(i) // it will work now
}
@TeaPod I see the problem, you have created and INFINITE loop.
for (int number = 0; number < 50; firstonex[number]++, firstoney[number]++){
// code sample
}
Since you never increment number the conditions number < 50 will be satisfied forever and the loop will not end. Try incrementing the number variable and see if it helps. (idk what your code is supposed to do but incrementing number variable will solve the infinite loop problem).
for (int number = 0; number < 50; number++, firstonex[number]++, firstoney[number]++){
// code sample
}
I hope this helps.
PS instead of changing the values in firstonex etc. in the bracket, why not do it in the for loop?
for (int number = 0; number < 50; number++){
firstonex[number]++;
firstoney[number]++;
// code sample
}
Answers
Hi @TeaPod! Could you please post a bit of your code so that we can find any bugs in it? Thanks!
But for starters, you should check your restrictions on how your for-loop should run. for example:
The above code will not run once because the conditions i <= -5 will never be met (the starting case,0, is greater than -5) and so the code in the for loop won't be executed
Instead I should do this
@Anix55 Here are the two relevant parts of the code, I hope this helps
@TeaPod I see the problem, you have created and INFINITE loop.
Since you never increment number the conditions number < 50 will be satisfied forever and the loop will not end. Try incrementing the number variable and see if it helps. (idk what your code is supposed to do but incrementing number variable will solve the infinite loop problem).
I hope this helps.
PS instead of changing the values in firstonex etc. in the bracket, why not do it in the for loop?
@anix55 It worked! thank you so much
@TeaPod I'm glad I could help. be sure to mark your question as answered (;