Start learning free

LESSON 112 OF 677 · ARRAYS I

Removing from an ArrayBuffer in Scala

Lesson

With scala.collection.mutable.ArrayBuffer, we can remove an element at an index using remove(index).

val arr = scala.collection.mutable.ArrayBuffer(1, 4, 6)
arr.remove(1)

// arr is now ArrayBuffer(1, 6)

Assignment
Follow the Coding Tutorial and remove an item.


Hint
Use remove(index).


STEP 1 OF 2
    Ctrl + Enter to check