Intervals
An interval is a sequence of values of the
same type between a given pair of endpoint values. Gosu provides native
support for intervals. For instance, the set of integers beginning with
0 and ending with 5 is an integer interval containing the values 0, 1,
2, 3, 4, 5. The Gosu syntax for this set is 0..5. Intervals are useful for
concise, readable for
loops. Intervals can be of many types including numbers, dates, dimensions,
and names. You can add custom interval types. In some programming languages,
intervals are called ranges.
