- Installing
- Hello World
- Spaces
- Identation
- Basics
- Comments
- Output
- ++ method
- Assignments and types
- Operator Precedence
- String interpolation
- Input
- Simple arithmetic
- Multiline strings
- Assert
- Arrays and literal arrays
- Literal intervals
- If, for, while and repeat-until
- Message sends
- Conversion between basic type values
- Anonymous functions
- Evaluating an anonymous function
- Functions with method foreach
- Prototypes
- Packages
- Gradual typing
- Generic prototypes
- Important metaobjects
- The CyanInterpreter prototype
Literal intervals
An interval is the return value of methods .. and ..< of the types Byte, Short, Int, Char, and Boolean. Then, if first and last are integers, first..last
returns an interval with all integers numbers between first and last, including this last one. Operator ..< does not include the last element.
var Interval<Int> inter;
inter = 3..5;
assert inter asArray == [ 3, 4, 5 ];
assert 5050 == 1..100 asArray sum;
inter = 3..5;
assert inter asArray == [ 3, 4, 5 ];
assert 5050 == 1..100 asArray sum;
Operator “..” has smaller precedence than the arithmetical operators and greater precedence than the logical and comparison operators.