# Functions

> Built-in ll* functions and user-defined functions in LSL.

:::caution[Stub]
This documentation page is a stub and is currently under development.
:::

## Built-in functions

The built-in functions are listed in the [function reference](/functions/) and grouped by [category](/categories/). From the wiki's delay page: "Some LSL functions delay script execution when they are called."

## User-defined functions

From the wiki: "LSL allows user-defined functions which will help keep scripts compact and readable, and allow code reuse."

```lsl
<return_type> function_name([<parameter1_type> parameter1[, <parameter2_type> parameter2[, ...]]])
{
  function_statements;

  ...

  return value_of_return_type;
}
```

- "User-defined functions must be defined before any states in the script or a syntax error will be generated on compilation."
- "The `return_type` may also be omitted for a void type function."
- "Parameters are passed by value, as with built-in functions. They behave like local variables and writing into them has no effect on what the function was called with."
- "If multiple return values are desired, they can be packed into a list, a vector or a rotation, depending on what you need to return."

## Reference

- [All functions](/functions/), [Categories](/categories/)
- [`return`](/controls/return/)
- [Types](/fundamentals/types/)

*Quotations are from the Second Life Wiki pages [Category:LSL User-Defined Functions](https://wiki.secondlife.com/wiki/Category:LSL_User-Defined_Functions), [LSL Delay](https://wiki.secondlife.com/wiki/LSL_Delay), by Second Life Wiki contributors, under [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/).*

---

From lsl.dev: https://lsl.dev/fundamentals/functions/
