Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save creaaa/23fa04fe8ec8f91048b84fca4fa12f02 to your computer and use it in GitHub Desktop.
Save creaaa/23fa04fe8ec8f91048b84fca4fa12f02 to your computer and use it in GitHub Desktop.
知っとくと、助けられる場面が来るかも
// 見ての通り、arrayLiteral の個数は可変
let x = Array<String>(arrayLiteral: "おとはす", "マリリ") // ["おとはす","マリリ"]
let y = Array<Int>(arrayLiteral: 1, 2, 3) // [1,2,3]
let z = Array<Int?>(arrayLiteral: nil) // [nil]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment