-
Notifications
You must be signed in to change notification settings - Fork 0
nil
ffredyk edited this page Jul 23, 2026
·
1 revision
Value Constructor
Nular — no operands.
nil
Returns the nil value — SQ#'s representation of "nothing." Nil serves as the null/undefined sentinel. Assigning nil to a variable deletes the variable entirely (matching Arma SQF behavior). nil is still valid as an array element and as a return value from functions.
nil is compiled to a nular command that pushes the singleton nil value onto the VM stack. It has no runtime cost beyond the push. In comparisons, nil compares equal only to itself.
_myVar = 42;
_myVar = nil; // _myVar no longer exists — variable deleted_arr = [1, nil, 3];
if (_arr select 1 == nil) then {
systemChat "Slot is empty";
};_doNothing = {
// no return statement → returns nil
};
_result = call _doNothing; // _result is nilif (isNil "_myGlobal") then {
_myGlobal = "default";
};ReadOnly — nil is a singleton immutable value. 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