Skip to content

Modern Array Pop

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

Home › Array › Array Container › Pop

Pop

Removes and returns the last element, or a default value if the array is empty.

Syntax

Pop( ) as T

Examples

#import "std/numeric"
#import "std/containers"
using containers, numeric

dim v as Array( of int32 )
v.Push( 10 ) : v.Push( 20 ) : v.Push( 30 )

print v.Pop( )           '' 30 -- removes and returns the last element
print v.Count            '' 2

'' Popping an empty array is not an error: it yields a default-constructed T
dim e as Array( of int32 )
print e.Pop( )           '' 0

Library: Array Container
Category: Array
Documented under: Members

Clone this wiki locally