Core concept

(1 to 5).sum  // 15
(0 until 10 by 2).toList
Advertisement

How it works

Lazy: doesn't allocate all elements upfront.

Advertisement

Trade-offs + gotchas

Iteration, ranges in tests, sequence generation.