# Switch function with Comparison Operators inside Cases

**URL:** <https://forum.kirupa.com/t/switch-function-with-comparison-operators-inside-cases/322183>\
**Category:** flash\
**Created:** [May 13, 2011, 8:25am UTC](https://forum.kirupa.com/t/switch-function-with-comparison-operators-inside-cases/322183 "2011-05-13T08:25:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emile7](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@Emile7](https://forum.kirupa.com/u/Emile7)\
**Post date:** [May 13, 2011, 8:25am UTC](https://forum.kirupa.com/t/switch-function-with-comparison-operators-inside-cases/322183/1 "2011-05-13T08:25:00Z")

</div>

Hi everyone,

I’m having difficulties with my switch script. Below is the code:

```auto
public function resultValue():void { 
			switch (_calcSwitch) {
				case 0: 
					break;
				case 1:
					for(var q:int; q < queryArray.length; q++) {
						_result = _result.(attribute(queryArray[q][0])==queryArray[q][1]);
					}
					trace(_result);
					trace(queryArray);
					trace("==");
					break;
				case 2:
					for(var w:int; w < queryArray.length; w++) {
						_result = _result.(attribute(queryArray[w][0])>=queryArray[w][1]);
					}
					trace(_result);
					trace(queryArray);
					trace(">=");
					break;
				case 3:
					for(var c:int; c < queryArray.length; c++) {
						_result = _result.(attribute(queryArray[c][0])<=queryArray[c][1]);
					}
					trace(_result);
					trace("<=");
					break;
				case 4:
					for(var r:int; r < queryArray.length; r++) {
						_result = _result.(attribute(queryArray[r][0])>queryArray[r][1]);
					}
					trace(_result);
					trace(">");
					break;
				case 5:
					for(var t:int; t < queryArray.length; t++) {
						_result = _result.(attribute(queryArray[t][0])<queryArray[t][1]);
					}
					trace(_result);
					trace("<");
					break;
				case 6:
					for(var i:int; i < queryArray.length; i++) {
						_result = _result.(attribute(queryArray*[0])!=queryArray*[1]);
					}
					trace(_result);
					trace("!=");
					break;
				default:
					trace("Er zijn geen entries!");
			}
		}

```

Inside the for loop you’ll notice the difference per case, I use ==, \>=, \<=, \>, \<, != per case. The point is that my program does this when I go in this order:

== to == to == to \>=, Works perfectly, i get my results clear.

\>= (and all the others) to ==, Does not work, it puts the ‘query’ in the array but won’t display the results. Somehow I’m getting the feeling that the script doesn’t know how to read from \>= to ==.

Anyone has any thoughts about this?

Thanks in advance!
