ge 4306b2220c breaking,fix: remove range exclusivity support
The usefulness of this feature is questionable, and its correct implementation
is difficult due to the use of generics. The implementation worked incorrectly
in cases where the iterator step is not equal to one and is not a multiple of
the end element. For example, for `range(0, 7, 4)`, the result is `[0]`
instead of `[0, 4]`. After this commit range end value is always included.

To check for multiples, a user-defined type must also implement an overload of
the remainder operator (`%`), even if the exclusivity function is not needed.

Another correct implementation requires subtracting one from the end element
for integers and the minimum fractional part supported by the type for floats.
This cannot be done correctly for generics, as it requires casting the literal
to a specific type, and we cannot cast number to any type.
2025-12-30 12:19:35 +03:00
2025-12-26 22:41:29 +03:00
2025-12-26 22:38:52 +03:00
2025-12-26 22:38:52 +03:00
2025-12-26 22:38:52 +03:00
2025-12-26 22:38:52 +03:00
2025-12-26 22:38:52 +03:00
2025-12-26 22:42:07 +03:00

Operating with Ranges of Numbers

The ranges module provides tools for creating ranges of numbers.

Ranges are represented by the generic Range iterator, which has start and end points, a step size, and an inclusive/exclusive flag.

import ranges

// Iterate from 0 to 5 with step 2. Negative values also supported.
for i in ranges.range(0, 5, 2) {
	println(i)
}
// 0
// 2
// 4

See more usage examples in ranges_test.v.

Description
Languages
V 100%