-
-
Save nickarthur/4e22e8f8830e456e3f9f9f0c7b8ecc02 to your computer and use it in GitHub Desktop.
type-cast-4
This file contains hidden or 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
| var integerValue = 42 | |
| var stringValue = String(describing: 42) | |
| var doubleValue = integerValue as! Double | |
| var floatValue = Int(stringValue) as? Float | |
| var array: [String] = ["eggs", "bacon", "ham", "cheese"] | |
| let arrayCount = Double(array.count as? String) | |
| var numArray: [Int] = [1, 2, 3, 4, 5] | |
| var anotherDouble = numArray[3] as? Double | |
| var isSunny = true | |
| var sunnyString = String(describing: isSunny) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment