0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Swift】配列の先頭3個を取り出す

Posted at

やろうとしたこと

  • 配列dummyから先頭3個の値を取り出す
  • String型はprefix(n)を使えば取得できるけど、そういえばArrayに対して.first以外で要素を取得したことってないと思って調べてみた

結論

QuizView.swift
// 注)dummyは[String]
let hoge = Array(dummy.prefix(3))
0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?