Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

for-loop weird thing.

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found something weird.


Why nothing output ? I think it should display "index=1".

Any help ?

Thanks.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the for loop, the boolean condition evaluates to false on the first try (when i is zero) because dddd does not contain "0". Therefore, the loop body never executes, and i is never incremented to 1.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic