Think of array type as collection of elements, every element has exactly same
type.
To declare type you need to start with array elements type and follow
with empty brackets []
.
char[]
int[]
str[]
For example:
main {
a: int[] = []
b: int[] = [1, 2, 3]
}
The Programming Language can infer type of array literal, it uses array elements value and tries to determine type of array element.
main {
a := [1, 2, 3]
}
NOTE:
It’s not always possible to infer array type, in situations where you pass empty brackets
a := []
, The Programming Language will not be able to infer array type.
For complete list of built-in features see API.