• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Strange loops?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, this is strange, using LibGDX for Android, but this seems to be irrelevant. Anyway, there's few loops that I should go through, but when I run/debug the application it just seems to skip over the loops and doesn't even bother to evaluate. I did try to change my for loop into a while loop, but there seems to be no difference. Parts of my code with loops:
blockNumber equals 14 in the debuger.


even a simple loop as: for (i=1; i >= 14; i++) { //whatever } just steps into it and next step jumps over after the loop...
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's hard to say what's happening since we're only seeing partial code. For example, I'm not sure what the second code block is for - it doesn't seem to go with the first code block, or with your last loop example.

If blockNumber = 14, then obviously it would not enter the loop in the first example.

Just as obviously, a loop start starts at i=1, and has a condition of "i>=14", will never be executed.
 
Gintaras Bubelevicius
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow, was working late till 5am so probably that got me seems it was just the more/less signs... was so sure it should work
reply
    Bookmark Topic Watch Topic
  • New Topic