Loops (for / while)
Iterating over ranges and collections with for, conditional repetition with while.
Simple enough for a 5-year-old to understand
range with for
the range written with to also includes the last number; until does not.
for i <- 1 to 5 do println(i)Loop over a list
val languages = List("Scala", "Java")for lang <- languages do println(lang)🎯 Exercise & Practice
Test what you've learned — answer, write code, check instantly. (1 left)