A list is another collection available in Scala.
A list is similar to an array but lists are immutable which means that the elements of a list cannot be changed by assignment and the lists represent a linked list whereas the arrays are flat.
Let's declare a list of strings, named
strList, having below elements in the same order.
Here, we must define the variable as a list of Strings as is the requirement above. So, use
List[String] while declaring the variable.
Switch to Jupyter tab.
Declare the list in Jupyter and press Shift+Enter.
Note that the list is displayed with its contents.
Click on "Submit Answer".
Taking you to the next exercise in seconds...