Skip to content
circular17 edited this page Oct 3, 2023 · 1 revision

A range is a sequence, typically of integers, either ascending, from a lower bound to an upper bound, or descending.

  • 0..=10 is the range from 0 to 10 included
  • 0..<10 is the range from 0 to 10 excluded (up to 9)
  • 0..<10 by 2 is the range 0, 2, 4, 6, 8
  • 20..>=10 is the range from 20 down to 10 included
  • 20..>10 by 2 is the range 20, 18, 16, 14, 12
  • 10+..5 is the range from 10 with 5 elements (up to 14)
  • 10-..5 is the range from 10 descending with 5 elements (down to 6)
Clone this wiki locally