Array ( type[] )
Fixed-size collection of elements.
Syntax
type[] name = {e1, e2, ...};Description
Arrays have a fixed size. Elements are accessed with 0-based indexing. Size is obtained with length (without parentheses).
Example
Loading editor…
Expected output
10 3
When to use?
Fixed number of values.
Common mistakes
- ⚠️ In arrays, length is a PROPERTY (no parentheses); in Strings, length() is a method.