# If variable=variable simple problem!

**URL:** <https://forum.kirupa.com/t/if-variable-variable-simple-problem/114837>\
**Category:** Uncategorized\
**Created:** [July 2, 2004, 7:02am UTC](https://forum.kirupa.com/t/if-variable-variable-simple-problem/114837 "2004-07-02T07:02:47Z")\
**Posts on this page:** 1\
**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/114837/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
