Created
October 4, 2016 09:40
-
-
Save takasek/a2c7aece3ab5a56e539e198743c12d2a to your computer and use it in GitHub Desktop.
やっぱり、他の数値型と違って、Boolをas NSNumberしたときだけは、同値は同一のclassインスタンスになるようだ #CodePiece
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
let num = 1 as NSNumber | |
num === num | |
//true | |
(num as Int as NSNumber) === (num as Int as NSNumber) | |
//false | |
(num as UInt as NSNumber) === (num as UInt as NSNumber) | |
//false | |
(num as Double as NSNumber) === (num as Double as NSNumber) | |
//false | |
(num as Bool as NSNumber) === (num as Bool as NSNumber) | |
//true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment