IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0
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).

inline_array

Provides a fixed-size array implementation with compile-time size checking.

The InlineArray 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 InlineArray 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: InlineArray[Int, 3] = [1, 2, 3]

# Access elements
print(arr[0]) # Prints 1

# Fill with a value
var filled = InlineArray[Int, 5](fill=42)

Structs

  • InlineArray: A fixed-size sequence of homogeneous elements where size is a constant expression.