Instance Property インスタンスプロパティ

first

The first element of the collection. コレクションの最初の要素。

Declaration 宣言

var first: UInt8? { get }

Discussion 議論

If the collection is empty, the value of this property is nil. コレクションが空であるならば、このプロパティはnilです。


let numbers = [10, 20, 30, 40, 50]
if let firstNumber = numbers.first {
    print(firstNumber)
}
// Prints "10"