-
Notifications
You must be signed in to change notification settings - Fork 0
count
ffredyk edited this page Jul 23, 2026
·
1 revision
Array / String
Unary — count <value>.
count <array>
count <string>
Returns the number of elements in an array, or the number of characters in a string. For nil, returns 0 (SQF compat). Works on both mutable and frozen arrays.
-
Array: returns the
.Countof the underlying list. O(1). -
String: returns
string.Length(character count). O(1). - Nil: returns 0 (Arma SQF compatibility).
_arr = [1, 2, 3, 4, 5];
_len = count _arr; // 5
if (count _enemies == 0) then {
systemChat "Area clear";
};_name = "Arma";
_len = count _name; // 4
if (count _input > 50) then {
systemChat "Input too long";
};for "_i" from 0 to (count _arr - 1) do {
_elem = _arr select _i;
process(_elem);
};_len = count _maybeNil; // 0 if nil, safeReadOnly — pure query. Safe from any 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