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

# CancelExecution

## Declaration

`Procedure CancelExecution;`

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
if Value > 10 then
begin
CancelExecution;
//this line will execute;
Exit;
//this line will not execute;
end;
end;
```

## Description

Cancels the execution of the Map (or Custom Script) immediately after the current script. Any code lines in the script following this function will still be executed. Use [Exit](/flow/guide/scripting-reference/functions/program-control/exit) to stop the processing of the remainder of the script.

The status of the Action is not affected (for Flow Logs or Notifications).

If the Action has one or more Actions Steps after the Map or Custom Script, the subsequent step(s) will still execute. To stop any subsequent Action Step, use [StopExecution](/flow/guide/scripting-reference/functions/program-control/stopexecution).
