Skip to content

deleteRange

ffredyk edited this page Jul 23, 2026 · 1 revision

deleteRange

Category

Array

Arity

Binary<array> deleteRange [startIndex, count].

<array> deleteRange <array>   // right side = [startIndex, count]

Description

Removes a range of elements from the array. The right operand is an array of two numbers: [startIndex, count]. Removes count elements starting at startIndex. No return value (void).

How It Works

Packs the parameters into an array on the right side (SQ# convention for 2+ parameter commands). Validates bounds, then calls List<Value>.RemoveRange(startIndex, count).

Usage

Remove range

_arr = [1, 2, 3, 4, 5, 6];
_arr deleteRange [1, 2];       // remove 2 elements starting at index 1
                                // _arr is [1, 4, 5, 6]

Remove from middle

_arr = ["keep", "junk1", "junk2", "keep2"];
_arr deleteRange [1, 2];       // _arr is ["keep", "keep2"]

Clear portion of array

// Remove first 3 elements
_arr deleteRange [0, 3];

Remove all from index

// Remove everything from index 5 to end
_arr deleteRange [5, count _arr - 5];

Thread Safety

Not thread-safe. Array must belong to the current scheduler.

See Also

SQ# Wiki

Home

Engine Docs

Migration

Commands

Value Constructors

Arithmetic

Comparison

Logic

Array

String

Math

Random

Type & Introspection

HashMap

Code Execution

Concurrency

Scheduler

Thread Safety

Error

Output

Time

Multiplayer

Compiler

Clone this wiki locally