Excellent work! In this lesson, we’ve learned the following concepts:

  • A list is a type of Kotlin Collection that contains ordered elements.
  • An immutable list is declared with listOf and indicates a list whose values cannot change throughout a program.
  • A mutable list is declared with mutableListOf and indicates a list whose values can be altered.
  • Elements within a list can be accessed using their index.
  • The size property returns the number of elements in a collection.
  • Immutable lists possess read-only functionalities, meanwhile, mutable lists support both read and write functionalities.
  • The contains() function checks if an element exists in a given list. It returns a Boolean true or false.
  • The add() function appends an element to the end of a mutable list.
  • The remove() function removes an element from a mutable list.
  • The random() function generates a random element from a given list.

You’ve covered a major, fundamental programming concept used in most programs to store and manipulate data. Feel free to utilize the empty Review.kt file and output terminal on the right to hone your understanding of lists and practice writing Kotlin code.


Click Up Next when you’re ready to move on.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?