We can get the number of elements in a Scala List using .size.
val ages = List(14, 32, 50, 21)
println(ages.size)
// prints 4
Assignment
Follow the Coding Tutorial and print the list size.
Hint
Use ages.size.
Free plan: 30 tutor messages. Premium is unlimited.
Saved
Ctrl + Enter to check