# If variable=variable simple problem!

**URL:** https://forum.kirupa.com/t/if-variable-variable-simple-problem/56278
**Category:** Uncategorized
**Created:** [July 2, 2004, 7:02am UTC](https://forum.kirupa.com/t/if-variable-variable-simple-problem/56278 "2004-07-02T07:02:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lplover2k2](https://avatars.discourse-cdn.com/v4/letter/l/96bed5/32.png) [@lplover2k2](https://forum.kirupa.com/u/lplover2k2)
#### Post date: [July 2, 2004, 7:02am UTC](https://forum.kirupa.com/t/if-variable-variable-simple-problem/56278/1 "2004-07-02T07:02:47Z")

</div>

Ok i’m having this problem;i have tried a lot of times to try to find what is wrong but could not;it looks pretty simple though but i’m a newbie;

here is the situation:  
I have 2 buttons:  
-Next page  
-Previous page

a dynamic text box where i load an external text;it is called “contents”(the var).

my “Previous page” button works fine while i’m having problem with my “next page” button.

I use loadVariablesNum("…/texts/"+pagenum+".txt", 0);  
So that when i press on  
next page" button;the pagenum is incremented and it loads 1.txt , 2.txt ,etc…(where in each text; “contents” variable is loaded).

I also use a variable(lastpage) so that to stop the “next page” button to go further than the last page.

I load the lastpage variable value from an external text too.

here is the code the “next page” button:

on (release) {  
if (pagenum=lastpage) {  
break;  
} else {  
pagenum = pagenum+1;  
loadVariablesNum("…/texts/"+pagenum+".txt", 0);  
}  
}

The “next page” button doesn’t stop when pagenum=lastpage.

Any idea why? thanks in advance

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 15, 2004, 2:42pm UTC](https://forum.kirupa.com/t/if-variable-variable-simple-problem/56278/2 "2004-07-15T14:42:04Z")

</div>

> [@lplover2k2](#):
>
> here they are with the texts
> 
> [http://www.geocities.com/lplover2k2/project.zip](http://www.geocities.com/lplover2k2/project.zip)
> 
> copy and paste in address bar if it does not work

anyone can help??? please

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 16, 2004, 8:35am UTC](https://forum.kirupa.com/t/if-variable-variable-simple-problem/56278/3 "2004-07-16T08:35:42Z")

</div>

```auto
else if(condition){action}
as opposed to else{condition;action}

```

and i wrote a mini tut on IF statements here: [http://www.kirupaforum.com/forums/showthread.php?t=60750&highlight=if+statements](http://www.kirupaforum.com/forums/showthread.php?t=60750&highlight=if+statements)  
why not do a search?

Prophet.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 17, 2004, 5:54pm UTC](https://forum.kirupa.com/t/if-variable-variable-simple-problem/56278/4 "2004-07-17T17:54:55Z")

</div>

thanks i have reada you tutorial but still don’t know why my code doesn’t work ☹
