Created
June 15, 2020 12:26
-
-
Save TarasShu/2d02e7e318216f715c08c5ff15ebe66b to your computer and use it in GitHub Desktop.
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 array = ["One", "Two", "Three"] | |
array.append("Four") | |
// This won't compile, since the above array is specialized | |
// for strings, meaning that other values can't be inserted: | |
array.append(5) | |
// As we pull an element out of the array, we can still treat | |
// it like a normal string, since we have full type safety. | |
let characterCount = array[0].count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment