For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
array
Provides a fixed-size array implementation with compile-time size checking.
The Array type represents a fixed-size sequence of homogeneous elements
where the size is determined at compile time. It provides efficient memory
layout and bounds checking while maintaining type safety. The Array
type is part of the prelude module and therefore does not need to be imported
in order to use it.
Examples:
# Create an array of 3 integers
var arr: Array[Int, 3] = [1, 2, 3]
# Access elements
print(arr[0]) # Prints 1
# Fill with a value
var filled = Array[Int, 5](fill=42)
comptime values
InlineArray
comptime InlineArray = Array[_, _]
A comptime alias to std.collections.Array to enable migration.
Structs
-
Array: A fixed-size sequence of homogeneous elements where size is a constant expression.