• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with my nested if statement  RSS feed

 
Bryce Heath
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys
I have been trying to figure out why this line of code never looks at the else if part of the if statement. I have been trying a long time now and no luck maybe someone can figure it out. This is not the exact code I edited it so it would make sense out of context, but as far as I can tell y is ++ but the else if is never run in the loop but all the rest of it is running correctly. Any help would be great.
 
Zeeshan Sheikh
Ranch Hand
Posts: 144
Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
else if will run if and only if first if condition is false so please check your logic.
 
Bryce Heath
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Thanks for the reply. I'm glad you took the time to look at this. Funny how such a simple mistake can take so long to figure out.
 
Campbell Ritchie
Marshal
Posts: 56541
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would do well to write your logic down as pseudo-code on a sheet of paper before trying to commit it to silicon. That might have prevented that mistake.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!