# Comparing variables inside functions to

**URL:** <https://forum.kirupa.com/t/comparing-variables-inside-functions-to/234045>\
**Category:** Uncategorized\
**Created:** [July 30, 2007, 2:23am UTC](https://forum.kirupa.com/t/comparing-variables-inside-functions-to/234045 "2007-07-30T02:23:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeiaGraf](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/leiagraf/32/3602_2.png) [@LeiaGraf](https://forum.kirupa.com/u/LeiaGraf)\
**Post date:** [July 30, 2007, 2:23am UTC](https://forum.kirupa.com/t/comparing-variables-inside-functions-to/234045/1 "2007-07-30T02:23:42Z")

</div>

Okay, here’s another one for you…

var q4:Boolean = false; //Will have thirty-eight of these, q4-q41

function noRepeat() {  
if ([COLOR=red]q(\_root.\_currentframe)[/COLOR] == true) {  
gotoAndStop(randRange(4, 41));  
} else if (([COLOR=#ff0000]q(\_root.\_currentframe)[/COLOR]) == false) {  
[COLOR=#ff0000]q(\_root.\_currentframe)[/COLOR] = true;  
}  
}

Now, my problem is the bits in red (yes, I know they don’t work, that was just the best way I could think to describe what I wanted).

If I create a string that says “q4” then I find it won’t compare that to the boolean variable, but I’m positive there must be a better way than putting one of these on every frame.

I’d love some advice on this one. It’s hurting my head!
