← Back to Docs
@unsafe
⚠️ Warning
@unsafe disables safety protections. Only use it when you fully understand the consequences. An unprotected loop can freeze your program indefinitely.
What is @unsafe?
@unsafe is an annotation you place directly before a while loop to disable the built-in loop protection.
Without @unsafe, any loop iteration that completes in under 2 seconds is blocked. With @unsafe, the loop runs with no speed checks.
Syntax
@unsafe while (condition) {
// loop body — no speed protection
}Example
class App {
fn fastCount(n) {
@unsafe while (n > 0) {
print("count:", n);
n = n - 1;
}
}
fastCount(1000);
}When to use @unsafe
- Tight computational loops (math, sorting, processing)
- Game loops that run at high frame rates
- Benchmarking or performance testing
- Any loop where you are certain it will terminate
When NOT to use @unsafe
- When you are unsure if the loop will terminate
- In production code where stability matters more than speed
- When learning VDX — let the safety system help you
What @unsafe disables
| Protection | Normal while | @unsafe while |
|---|---|---|
| Iteration speed check (< 2s) | ✓ Active | ✗ Disabled |
Rules
@unsafecan only be placed directly beforewhile- It cannot be used on other statements (if, fn, let, etc.)
- Using
@unsafebefore anything other thanwhileis a compile error