Fundamentals9 / 9
Up next

Ranges

@main def main(): Unit =
  // `to` includes the end, `until` excludes it
  val inclusive = (1 to 5).toList
  val exclusive = (1 until 5).toList
  // `by` sets the step
  val evens = (0 to 10 by 2).toList
  println(s"$inclusive $exclusive $evens")
What you're solving

to, until, and by