---
url: >-
  /statelake/scripting-reference/functions-and-procedures/program-control-functions/exit.md
---

# Exit

Calling the procedure **Exit** will immediately end the execution of the script, at that point in the script.

Any code lines following the **Exit** function will not be executed.

Within the **Map**, the next event will still be executed (unless a function like **LogError** or **CancelExecution** was called prior to **Exit**);

**Declaration**: Procedure Exit;

Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
 //if value is greater than 10, the script will end immediately and line 5 + 6 will not execute
 If Value > 10 then Exit;
  Value := Value + 1;
  LogInfo('Value has been updated!');
end;
```
