Skip to content

Instantly share code, notes, and snippets.

@TarasShu
Created June 15, 2020 12:26
Show Gist options
  • Save TarasShu/2d02e7e318216f715c08c5ff15ebe66b to your computer and use it in GitHub Desktop.
Save TarasShu/2d02e7e318216f715c08c5ff15ebe66b to your computer and use it in GitHub Desktop.
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