# Operators "if +1 or -1 but not undefined"

**URL:** <https://forum.kirupa.com/t/operators-if-1-or-1-but-not-undefined/183509>\
**Category:** flash\
**Created:** [March 27, 2006, 7:17pm UTC](https://forum.kirupa.com/t/operators-if-1-or-1-but-not-undefined/183509 "2006-03-27T19:17:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zaid\_W1red](https://avatars.discourse-cdn.com/v4/letter/z/cab0a1/32.png) [@Zaid\_W1red](https://forum.kirupa.com/u/Zaid_W1red)\
**Post date:** [March 27, 2006, 7:17pm UTC](https://forum.kirupa.com/t/operators-if-1-or-1-but-not-undefined/183509/1 "2006-03-27T19:17:20Z")

</div>

Hey guys,

Im trying to put an if statement together that executes “if +1 or -1 but not undefined”.

Basically if an earlier specified var, is greater in value or less then before. Im building a destop ap that draws these vars in from the web, and the problem is, when I use \<\>, \> works fine …but if I use \< …then my if statement executes if the vars are returned as undefined (eg if the server times out or net connection drops).

How would you guys go about putting this statement?

Phew…this has been a little difficult to explain, if anyone confused or needs anymore info please ask 😃

Zaid

---

<div class="post-metadata">

**Author:** ![Zaid\_W1red](https://avatars.discourse-cdn.com/v4/letter/z/cab0a1/32.png) [@Zaid\_W1red](https://forum.kirupa.com/u/Zaid_W1red)\
**Post date:** [March 28, 2006, 12:14pm UTC](https://forum.kirupa.com/t/operators-if-1-or-1-but-not-undefined/183509/2 "2006-03-28T12:14:56Z")

</div>

Is there no one that would even hazard a guess??

---

<div class="post-metadata">

**Author:** ![serkios](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/serkios/32/608_2.png) [@serkios](https://forum.kirupa.com/u/serkios)\
**Post date:** [March 28, 2006, 6:44pm UTC](https://forum.kirupa.com/t/operators-if-1-or-1-but-not-undefined/183509/3 "2006-03-28T18:44:22Z")

</div>

you mean something like this?

[AS]  
if ((someVar == -1 || someVar == 1) && someVar != undefined) {  
// do stuff  
}[/AS]
