Created
March 14, 2012 21:22
-
-
Save osdrv/2039616 to your computer and use it in GitHub Desktop.
primitives equality
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int a = 1; | |
num b = 1; | |
Integer c = 1; | |
print( a === b ); // => true | |
print( a == b ); // => true | |
print ( a === c ) // => true | |
print ( b === c ) // => true | |
double a = 1; | |
int b = 1; | |
print( a === b ); // true | |
print( a == b ); // true | |
double a = 3465346583465243765923847659234765928347659567398475647495873984572947593470294387093493456870849216348723763945678236420938467345762304958724596873045876234572037862934765294365243652548673456705673465273465246734506873456729457623845623456234650457693475603768922346728346256; | |
int b = 3465346583465243765923847659234765928347659567398475647495873984572947593470294387093493456870849216348723763945678236420938467345762304958724596873045876234572037862934765294365243652548673456705673465273465246734506873456729457623845623456234650457693475603768922346728346256; | |
print( a === b ); // ooops, false! | |
print( a == b ); // true | |
String a = "a"; | |
String b = "a"; | |
print( a === b ); // true | |
var a = "a"; | |
String b = "a"; | |
print( a === b ); // true | |
List a = [ 1, 2, 3 ]; | |
List b = [ 1, 2, 3 ]; | |
print( a == b ); // false | |
Map a = { "1": "a", "2": "b" }; | |
Map b = { "1": "a", "2": "b" }; | |
print( a == b ); // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment