# "Non-strict equality" operator and variable conversion

**URL:** <https://forum.kirupa.com/t/non-strict-equality-operator-and-variable-conversion/323126>\
**Category:** flash\
**Created:** [June 17, 2011, 10:12pm UTC](https://forum.kirupa.com/t/non-strict-equality-operator-and-variable-conversion/323126 "2011-06-17T22:12:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IQAndreas](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@IQAndreas](https://forum.kirupa.com/u/IQAndreas)\
**Post date:** [June 17, 2011, 10:12pm UTC](https://forum.kirupa.com/t/non-strict-equality-operator-and-variable-conversion/323126/1 "2011-06-17T22:12:36Z")

</div>

This is what the language reference says:

> [Operators - Adobe ActionScript® 3 (AS3) API Reference](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/operators.html#equality)  
> Automatic data type conversion converts the data types of String, Boolean, int, uint, and Number values to compatible types and the converted values are equal, in which case operands are considered equal.

Which basically means, if you compare a String, Boolean, int, uint, or Number when doing “==”, if they are not the same type, they will be converted before being checked.

For instance:

```auto
trace(1 == true); //true

```

As the language reference doesn’t go into detail:

[LIST]  
[_]What are the “nitty gritty” rules behind this conversion?  
[_]When does it convert an int to a String and compare them, and when does it convert the String to an int and compare them?  
[\*]Are there cases when it makes a difference in the output if A is converted to B and vice versa?  
[/LIST]
