Skip to content

Commit cbce785

Browse files
authored
Merge pull request #5333 from LouisDhauwe/master
2 parents f08601f + f9cd8b1 commit cbce785

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

stdlib/public/core/BidirectionalCollection.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ extension BidirectionalCollection where SubSequence == BidirectionalSlice<Self>
204204

205205
extension BidirectionalCollection where SubSequence == Self {
206206
/// Removes and returns the last element of the collection.
207+
///
208+
/// Use `popLast()` to remove the last element of a collection that might be empty.
209+
///
210+
/// The `removeLast()` method must be used only on a nonempty collection.
207211
///
208212
/// - Returns: The last element of the collection if the collection has one
209213
/// or more elements; otherwise, `nil`.
@@ -221,6 +225,9 @@ extension BidirectionalCollection where SubSequence == Self {
221225
///
222226
/// The collection must not be empty.
223227
///
228+
/// To remove the last element of a collection that might be empty,
229+
/// use the `popLast()` method instead.
230+
///
224231
/// - Returns: The last element of the collection.
225232
///
226233
/// - Complexity: O(1)

0 commit comments

Comments
 (0)