---
url: /statelake/scripting-reference/functions-and-procedures/what-is-a-function.md
---

# What Is A Function

A **Function** is a piece of code that is called to perform a particular task, and will return a value to the calling script.

While there are many pre-defined functions such as **StringToDateTime** and **FloatToStr**, it is possible to create your own user-defined functions.

* By default, pre-defined functions are classed as global functions, as they are part of the processing environment and as such do not need to be declared (or set-up).
* Global functions are available throughout the system across all scripts.
* Local functions are those that are only available and accessible in the script in which they are declared.
* User-defined functions are classed as local functions by default. However, it is possible to make a user-defined function available in multiple locations, by creating and declaring the function in an include file.
