for loop troubles :'(

Discussion in 'Plugin Development' started by Pizza371, Sep 23, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Pizza371

    Ok so..
    for(int i = page; i < (i + 9); i++) {
    so i + 9 DOES = 9.
    Since the page int is 0. I have got this for a reason, but I tested it, and (i + 9) does equal 9.
    yet, the variable i goes beyond 9, over 10, what am I doing wrong I'm really confused lol.
    Help much appreciated!
     
  2. Offline

    Rockslide

    for ( int i = page; i < (page + 9); i++) {
    }
     
    Pizza371 likes this.
  3. Offline

    L33m4n123

    What do you want to achieve?

    You want that it stops at 9? then you only need to do

    for (int i = page; i < 9; i++) {
    code
    }

    Maybe you figure your error out yourself otherwise I explain you more how the for loop works^^
     
    Pizza371 likes this.
  4. Offline

    Pizza371

    Rockslide Thank you! I understand how I was doing it wrong now, i was going up as I was comparing it =/=.
    EDIT:
    L33m4n123 thx but I figured it! ;)
     
Thread Status:
Not open for further replies.

Share This Page