Skip to content

Modern Array Capacity

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Array › Array Container › Capacity

Capacity

Returns how many elements fit before the array has to grow.

Syntax

Capacity( ) as int32

Examples

#import "std/containers"
using containers

dim v as Array( of int32 )
print v.Capacity         '' 0 -- nothing allocated yet

v.Push( 1 )
print v.Capacity         '' 8 -- the minimum allocation

for i as int32 = 2 to 9
    v.Push( i )
next
print v.Count & " of " & v.Capacity     '' 9 of 16 -- doubled, not grown by one

Library: Array Container
Category: Array
Documented under: Members

Clone this wiki locally