# Operator in a variable

**URL:** <https://forum.kirupa.com/t/operator-in-a-variable/261000>\
**Category:** Uncategorized\
**Created:** [May 21, 2008, 10:33pm UTC](https://forum.kirupa.com/t/operator-in-a-variable/261000 "2008-05-21T22:33:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RebuiltJorge](https://avatars.discourse-cdn.com/v4/letter/r/94ad74/32.png) [@RebuiltJorge](https://forum.kirupa.com/u/RebuiltJorge)\
**Post date:** [May 21, 2008, 10:33pm UTC](https://forum.kirupa.com/t/operator-in-a-variable/261000/1 "2008-05-21T22:33:12Z")

</div>

is it possible to store an operator such as \>= in a variable, for example:  
ActionScript Code:  
[LEFT][COLOR=#000000] **var** [/COLOR] myOperator;  
[COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR]randomNumber == [COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]  
myOperator = \>=;  
[COLOR=#000000]}[/COLOR][COLOR=#0000FF]else[/COLOR][COLOR=#000000]{[/COLOR]  
myOperator = \<=;  
[COLOR=#000000]}[/COLOR]  
[/LEFT]

I know this sounds strange.

---

<div class="post-metadata">

**Author:** ![hoolagon](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@hoolagon](https://forum.kirupa.com/u/hoolagon)\
**Post date:** [May 21, 2008, 10:36pm UTC](https://forum.kirupa.com/t/operator-in-a-variable/261000/2 "2008-05-21T22:36:12Z")

</div>

i dunno, but there is probably another way to achieve the same result. What is it you are trying to do?

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [May 21, 2008, 10:54pm UTC](https://forum.kirupa.com/t/operator-in-a-variable/261000/3 "2008-05-21T22:54:39Z")

</div>

It’s not possible because operators in ActionScript are not first-class objects. hoolagon is right about there being another way to do the same thing, though.
