Ranges/Aliases
Ranges
A range represents a range of numbers or in some contexts a range of types. A range has a lower and a upper bound.
let range = 1..200;
The sample above uses a range from 1 to 200 inclusive. That means an array will be instantiated with all the values from 1 to 200.
Type Aliases
You can use a type by a custom name. This is called a type alias. (Currently type aliases are bound to the whole assembly/program)
The definition:
<type_alias> ::= "using" <identifier> "as" <identifier> ";"
Example:
using int as i32;
func main() -> int {
return 42;
}
As you can see in the sample above the alias type can be used as if it were a normal integer.
Last updated