# Help with if statement

**URL:** <https://forum.kirupa.com/t/help-with-if-statement/3573>\
**Category:** programming\
**Created:** [January 21, 2002, 8:57pm UTC](https://forum.kirupa.com/t/help-with-if-statement/3573 "2002-01-21T20:57:56Z")\
**Posts on this page:** 9\
**Page:** 1

<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:** [January 21, 2002, 8:57pm UTC](https://forum.kirupa.com/t/help-with-if-statement/3573/1 "2002-01-21T20:57:56Z")

</div>

I am using the following if statement but each time the statement is called it changes the variable “status” to 2 regardless. If the status is 1 going into the frame that contains this statement it is changed to 2.

if (status = 2) {  
&nbsp &nbsp &nbsp &nbsp \_root.step.gotoAndStop(630);  
&nbsp &nbsp &nbsp &nbsp \_root.step.back.gotoAndPlay(“loop”);  
} else {  
&nbsp &nbsp &nbsp &nbsp gotoAndPlay(2);  
}

Any help is appreciated.  
Thanks!

---

<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:** [January 21, 2002, 9:02pm UTC](https://forum.kirupa.com/t/help-with-if-statement/3573/2 "2002-01-21T21:02:49Z")

</div>

you must use double = , as in (status==2), else you’re not checking status, but setting it to 2!  
simple as that 🙂

---

<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:** [January 21, 2002, 9:03pm UTC](https://forum.kirupa.com/t/help-with-if-statement/3573/3 "2002-01-21T21:03:33Z")

</div>

… but it seems to me that the problem happened when you declared what the variable was equal to.

Can I see the script for that part?

---

<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:** [January 21, 2002, 9:08pm UTC](https://forum.kirupa.com/t/help-with-if-statement/3573/4 "2002-01-21T21:08:21Z")

</div>

Nope, “if (status = 2)” will set status to 2 every time the if statement is entered!

---

<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:** [January 21, 2002, 9:13pm UTC](https://forum.kirupa.com/t/help-with-if-statement/3573/5 "2002-01-21T21:13:59Z")

</div>

That did the trick!! thanks!!  
Here is the correctd script.

if (status == 2) {  
&nbsp &nbsp &nbsp &nbsp \_root.step.gotoAndPlay(630);  
&nbsp &nbsp &nbsp &nbsp \_root.step.back.gotoAndPlay(“loop”);  
} else {  
&nbsp &nbsp &nbsp &nbsp gotoAndPlay(2);  
}

---

<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:** [January 21, 2002, 9:16pm UTC](https://forum.kirupa.com/t/help-with-if-statement/3573/6 "2002-01-21T21:16:39Z")

</div>

If you are wondering what I am working on here ya go.

I call it my virtual Escalator.

[www.jaycook.net/escalator](http://www.jaycook.net/escalator)

I am an engineer for an escalator company. I am trying to get the escalator to run up and down. Well thanks to your help it will.

---

<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:** [January 21, 2002, 9:18pm UTC](https://forum.kirupa.com/t/help-with-if-statement/3573/7 "2002-01-21T21:18:01Z")

</div>

Pfft. You think you’re so great just because you noticed there was only one equals sign.

… Jerk.

… Maudit…

… Hey, I never noticed before that the french word for “Dammit” is “Bad Word”! (Well, “Bad Say”, to translate litteraly.) Heh. How clever.

---

<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:** [January 21, 2002, 10:34pm UTC](https://forum.kirupa.com/t/help-with-if-statement/3573/8 "2002-01-21T22:34:23Z")

</div>

Ohhh…so you’re insulting me? P’tit con va!

🙂 I hope you’ll understand i’m only joking, was grinning when writing this, jus’ a lil’ fun, okiedokie?

---

<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:** [January 21, 2002, 11:29pm UTC](https://forum.kirupa.com/t/help-with-if-statement/3573/9 "2002-01-21T23:29:20Z")

</div>

Likewise, of course.
