Last active
February 5, 2019 21:12
-
-
Save mildocjr/209a2df491467f57772fc317e4dd4790 to your computer and use it in GitHub Desktop.
type-cast-1
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 someNumber: Int = 150 | |
| var someString: String | |
| someString = String(describing: someNumber) | |
| // by using print() we actually perform type casting on integers | |
| print(someNumber) // prints "150" | |
| // the result of print(someNumber) will look the same but it's a | |
| // string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment