# Functions

Functions can shorten code and make it faster.

You use it primary, if you know you will have something more times, for example getting member information, you will do it in multiple commands, then use function.

There are 2 types of functions

## Normal function

This function will do something, and won´t return any value

<figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2FVd6xWhD1ZXEvFP1UPFk2%2Fscreenshot%20-%202022-10-24T131607.197.png?alt=media&#x26;token=73bfb959-a529-43b8-acc5-821700cd7f50" alt=""><figcaption><p>Example of using functionT</p></figcaption></figure>

This will send a message to channel saying that user bought a potato

## Function with returning value

<figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2FFKleyQ2AyayYnY0eXIFj%2Fscreenshot%20-%202022-10-24T131227.947.png?alt=media&#x26;token=af7d7d90-05ef-495d-8091-ae13c2052d38" alt=""><figcaption><p>Example of using this function</p></figcaption></figure>

{% code title="Output" %}

```
number is 0
```

{% endcode %}
