diff --git a/doc/site/core/list.markdown b/doc/site/core/list.markdown index 14ded6dc..823f5f73 100644 --- a/doc/site/core/list.markdown +++ b/doc/site/core/list.markdown @@ -37,6 +37,10 @@ are shifted up to fill in where the removed element was. list.removeAt(1) IO.print(list) // "[a, c, d]". +Returns the removed item. + + IO.print(["a", "b", "c"].removeAt(1) // "b". + It is a runtime error if the index is not an integer or is out of bounds. ### **[**index**]** operator diff --git a/doc/site/lists.markdown b/doc/site/lists.markdown index ecae8dfd..39fdef6e 100644 --- a/doc/site/lists.markdown +++ b/doc/site/lists.markdown @@ -95,9 +95,13 @@ given position in the list. All following items are shifted up to fill in the gap: :::dart - var letters = ["a", "b", "c"] + var letters = ["a", "b", "c", "d"] letters.removeAt(1) - IO.print(letters) // ["a", "c"] + IO.print(letters) // ["a", "c", "d"] + +The `removeAt` method returns the removed item: + + IO.print(letters.removeAt(1)) // "c" If you want to remove everything from the list, you can clear it: