---
url: >-
  /statelake/scripting-reference/functions-and-procedures/what-is-a-procedure/calling-procedures.md
---

# Calling Procedures

Like functions, **Procedures** are simple instruction statements that are entered into your script by entering its name and providing the appropriate parameters (or arguments) as parameter names or values into a statement block within parentheses between a **begin** statement and an **end** statement.

At the end of the procedure line, following the closing parenthesis, is a semi-colon (;). This is known as a procedure call.

The following example calls the procedure **LogInfo** and passes in a single parameter contained inside the single text quotes within the parentheses ‘This is the text to be written to the log.’);

```pascal
LogInfo('This is the text to be written to the log.');
```

When calling a **Procedure** that has multiple parameters, these parameters are separated by a comma such as in this call below.

The **Procedure Delete** passes in three parameters - the value in the variable **MyStringVariable** and the values of **1** and **15**. This is an example of a **Procedure** that modifies the input parameter **MyStringVariable**, and starting at position **1**, deletes the next **15** characters.

At the end of this procedure call, **MyStringVariable** will have had the first 15 characters deleted.

```pascal
Delete(MyStringVariable,1,15);
```

**Procedures** cannot be used on the right-hand side of an assignment operator. This is because a **Procedure** does not return a result, therefore it cannot be assigned to a variable in the same way as a function can.

You must always pass in a value for each parameter listed within the parentheses - if three parameters are required then you must pass in all three parameters. It is not possible to completely skip or ignore a parameter, however you can pass a blank or null value in some cases.

To call the user-defined **Procedure** called **RemoveNonKeyboardChars**, you could use the following to remove the non-keyboard characters that are included in the string called **WhatName**.

```pascal
procedure ScriptEvent (var Value : variant);
var
  WhatName, WhatName2 : string;
begin
  WhatName := 'Line1 x βæ©';
  WhatName2 := WhatName;
  RemoveNonKeyboardChars(WhatName2);
  LogInfo('Non-keyboard string is >>'+WhatName+'<<');
  LogInfo('Keyboard string is >>'+WhatName2+'<<');
end;
```

There are no parameters to include in the call of the procedure **DumpDataview**, as illustrated below. Remember that the procedure name is not case sensitive.

```pascal
procedure ScriptEvent (var Value : variant);
begin
  ......
  dumpdataview;
  ......
end;
```
