實例方法
min()
返回可比較元素的異步序列中的最小元素。
聲明
@warn_unqualified_access func min() async rethrows -> Self.Element?
當
Element
符合 Comparable
時可用。返回值
序列的最小元素。如果序列沒有元素,則返回 nil
。
詳述
在此示例中,名為 Counter
的異步序列生成從 1
到 10
的 Int
值。 min()
方法返回序列的最小值。
let min = await Counter(howHigh: 10)
.min()
print(min ?? "none")
// Prints: 1
可用版本
iOS 13.0+, iPadOS 13.0+, macOS 10.15+, Mac Catalyst 13.0+, tvOS 13.0+, watchOS 6.0+
相關用法
- Swift AsyncPrefixWhileSequence min(by:)用法及代碼示例
- Swift AsyncPrefixWhileSequence max()用法及代碼示例
- Swift AsyncPrefixWhileSequence max(by:)用法及代碼示例
- Swift AsyncPrefixWhileSequence map(_:)用法及代碼示例
- Swift AsyncPrefixWhileSequence reduce(_:_:)用法及代碼示例
- Swift AsyncPrefixWhileSequence compactMap(_:)用法及代碼示例
- Swift AsyncPrefixWhileSequence contains(where:)用法及代碼示例
- Swift AsyncPrefixWhileSequence allSatisfy(_:)用法及代碼示例
- Swift AsyncPrefixWhileSequence drop(while:)用法及代碼示例
- Swift AsyncPrefixWhileSequence filter(_:)用法及代碼示例
- Swift AsyncPrefixWhileSequence first(where:)用法及代碼示例
- Swift AsyncPrefixWhileSequence dropFirst(_:)用法及代碼示例
- Swift AsyncPrefixWhileSequence contains(_:)用法及代碼示例
- Swift AsyncPrefixWhileSequence prefix(_:)用法及代碼示例
- Swift AsyncPrefixWhileSequence flatMap(_:)用法及代碼示例
- Swift AsyncPrefixWhileSequence prefix(while:)用法及代碼示例
- Swift AsyncPrefixSequence dropFirst(_:)用法及代碼示例
- Swift AsyncPrefixSequence contains(_:)用法及代碼示例
- Swift AsyncPrefixSequence filter(_:)用法及代碼示例
- Swift AsyncPrefixSequence max(by:)用法及代碼示例
- Swift AsyncPrefixSequence contains(where:)用法及代碼示例
- Swift AsyncPrefixSequence first(where:)用法及代碼示例
- Swift AsyncPrefixSequence map(_:)用法及代碼示例
- Swift AsyncPrefixSequence max()用法及代碼示例
- Swift AsyncPrefixSequence min(by:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 AsyncPrefixWhileSequence min()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。