# deleteRange ## Category Array ## Arity **Binary** — ` deleteRange [startIndex, count]`. ``` deleteRange // 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.RemoveRange(startIndex, count)`. ## Usage ### Remove range ```sqf _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 ```sqf _arr = ["keep", "junk1", "junk2", "keep2"]; _arr deleteRange [1, 2]; // _arr is ["keep", "keep2"] ``` ### Clear portion of array ```sqf // Remove first 3 elements _arr deleteRange [0, 3]; ``` ### Remove all from index ```sqf // 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 - [deleteAt](deleteAt.md) — remove single element - [pushBack](pushBack.md) — append element - [append](append.md) — append multiple - [resize](resize.md) — change array size