more docs on ranges

This commit is contained in:
Sergey Chernov 2025-05-31 18:58:14 +04:00
parent b82a97ed20
commit 2b3b0b298c

View File

@ -9,7 +9,7 @@ __Other documents to read__ maybe after this one:
- [Advanced topics](advanced_topics.md) - [Advanced topics](advanced_topics.md)
- [OOP notes](OOP.md) - [OOP notes](OOP.md)
- [math in Ling](math.md) - [math in Ling](math.md)
- Some class references: [List](List.md), [Real](Real.md) - Some class references: [List](List.md), [Real](Real.md), [Range](Range.md)
# Expressions # Expressions
@ -585,6 +585,27 @@ There are self-assigning version for operators too:
sum sum
>>> 5050 >>> 5050
# Ranges
Ranges are convenient to represent the interval between two values:
5 in (0..100)
>>> true
It could be open and closed:
assert( 5 in (1..5) )
assert( 5 !in (1..<5) )
>>> void
Ranges could be inside other ranges:
assert( (2..3) in (1..10) )
>>> void
See [Ranges](Range.md) for detailed documentation on it.
# Comments # Comments
// single line comment // single line comment