PageSourceSearch

https://mojolang.org/assets/js/93ece44b.c0c9beec.js

js mojolang.org collected 2026-10-01 11:57:49 UTC 3,382 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkmodular_fe=self.webpackChunkmodular_fe||[]).push([["10355"],{13384(e,t,n){n.r(t),n.d(t,{metadata:()=>i,default:()=>m,frontMatter:()=>o,contentTitle:()=>a,toc:()=>l,assets:()=>c});var i=JSON.parse('{"id":"docs/std/collections/array/index","title":"array","description":"Provides a fixed-size array implementation with compile-time size checking.","source":"@site/versioned_docs/version-1.1.0/docs/std/collections/array/index.md","sourceDirName":"docs/std/collections/array","slug":"/docs/std/collections/array/","permalink":"/docs/std/collections/array/","draft":false,"unlisted":false,"editUrl":"https://github.com/modular/modular/edit/main/Mojo/docs/site/std/collections/array/index.md","tags":[],"version":"1.1.0","frontMatter":{"title":"array","version":"1.1.0.dev0","type":"module","namespace":"std.collections","lang":"mojo","description":"Provides a fixed-size array implementation with compile-time size checking."},"sidebar":"stdSidebar","previous":{"title":"collections","permalink":"/docs/std/collections/"},"next":{"title":"Array","permalink":"/docs/std/collections/array/Array"}}'),s=n(74848),r=n(28453);let o={title:"array",version:"1.1.0.dev0",type:"module",namespace:"std.collections",lang:"mojo",description:"Provides a fixed-size array implementation with compile-time size checking."},a,c={},l=[{value:"Structs",id:"structs",level:2}];function d(e){let t={a:"a",code:"code",div:"div",h2:"h2",li:"li",p:"p",pre:"pre",section:"section",ul:"ul",...(0,r.R)(),...e.components};return(0,s.jsxs)(t.section,{className:"mojo-docs",children:["\n",(0,s.jsxs)(t.div,{className:"mojo-module-detail",children:["\n",(0,s.jsx)(t.p,{children:"Provides a fixed-size array implementation with compile-time size checking."}),"\n",(0,s.jsxs)(t.p,{children:["The ",(0,s.jsx)(t.code,{children:"Array"})," type represents a fixed-size sequence of homogeneous elements\nwhere the size is determined at compile time. It provides efficient memory\nlayout and bounds checking while maintaining type safety.  The ",(0,s.jsx)(t.code,{children:"Array"}),"\ntype is part of the ",(0,s.jsx)(t.code,{children:"prelude"})," module and therefore does not need to be imported\nin order to use it."]}),"\n",(0,s.jsx)(t.p,{children:"Examples:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-mojo",children:"# Create an array of 3 integers\nvar arr = [1, 2, 3]\n\n# Access elements\nprint(arr[0])  # Prints 1\n\n# Fill with a value\nvar filled = Array[Int, 5](fill=42)\n"})}),"\n"]}),"\n",(0,s.jsx)(t.h2,{id:"structs",children:"Structs"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsxs)(t.a,{href:"../../../../docs/std/collections/array/Array",children:["\u200B",(0,s.jsx)(t.code,{children:"Array"})]}),": A fixed-size sequence of homogeneous elements where size is a constant expression."]}),"\n"]}),"\n"]})}function m(e={}){let{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},28453(e,t,n){n.d(t,{R:()=>o,x:()=>a});var i=n(96540);let s={},r=i.createContext(s);function o(e){let t=i.useContext(r);return i.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),i.createElement(r.Provider,{value:t},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.