• Post Reply Bookmark Topic Watch Topic
  • New Topic

while Loop  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone!

I'm using a while loop and when i run it its giving an infinite loop!
I would like to know what causes an infinite loop to occur!!

Thanks

Olliver
 
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An infinite loop occurs with a while loop if the condition in the while loop is never false.
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what you can do it put some println statement inside the loop, to print whatever the variable is you use in your condition. check to make sure you really are changing it, or that the logic that would change it is correct.

if you are still stuck, feel free to post the code here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!