---
url: /flow/guide/scripting-reference/functions/program-control/exit.md
---

# Exit

## Declaration

`Procedure Exit;`

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
If Value > 10 then Exit;

Value := Value + 1; //if value is greater than 10 then this line will no execute.
end;
```

## Description

Calling Exit will immediately end the execution of the script. Any code lines following the Exit function will not be executed. The next event will still be executed (unless a function like [LogError](/flow/guide/scripting-reference/functions/logging/logerror) or [CancelExecution](/flow/guide/scripting-reference/functions/program-control/cancelexecution) was called prior to Exit);
