-
Notifications
You must be signed in to change notification settings - Fork 0
reverse
ffredyk edited this page Jul 23, 2026
·
1 revision
Array
Unary — reverse <array>.
reverse <array>
Reverses the order of elements in the array in-place. The array is modified directly. Returns nil.
Calls List<Value>.Reverse() on the underlying list. All elements are reordered. O(n) time, O(1) extra space.
_arr = [1, 2, 3, 4];
reverse _arr; // _arr is [4, 3, 2, 1]_arr = ["a", "b", "c"];
reverse _arr;
{ systemChat _x } forEach _arr; // prints "c", "b", "a"_isPalindrome = {
params ["_arr"];
_copy = +_arr; // shallow copy
reverse _copy;
str _arr == str _copy
};reverse _arr; // first reverse
// ... do work ...
reverse _arr; // restore original orderNote: Unlike
sort,reversedoes not take a direction argument — it always reverses.
Not thread-safe. Array must belong to the current scheduler.
- Getting Started
- Language Guide
- Type System
- Control Flow
- Functions & Code
- Strings & Text
- Arrays & Collections
- Concurrency
- Promise System
- Thread Safety
- Host API & Embedding
- CLI Tool
- Bytecode Reference
- Multiplayer
- Syntax Sugar
- Optimization Guide
- Benchmarks
- count
- select
- pushBack
- append
- deleteAt
- deleteRange
- resize
- reverse
- sort
- find
- in
- forEach
- freeze
- thaw
- isFrozen
- currentScheduler
- clientOwner
- allSchedulers
- schedulerName
- schedulerExists
- schedulerBudget
- setSchedulerBudget
- fiberCount
- readyFiberCount
- waitingFiberCount
- schedulerLoad
- sendTo