Created
August 11, 2018 01:51
-
-
Save mildocjr/237787d3a26d6c11e2143f3435d2b8e1 to your computer and use it in GitHub Desktop.
type-cast-4
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
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