Now that you've been introduced to every component it is a good time to meet some functions, which are going to be crucial for making our first app.

Functions are basically sections of the code that receive and return some values and can be used in many ways.

They are crucial if you want to keep your code clean and fast. Also, they allow for some quick upgrades without having to redo half of the code.

Every program is made out of two main functions that we've already mentioned - void setup and void loop.

Other functions work pretty much the same way.
Before we begin, add the "begin nibble variant" block:

How do functions work?

You can create a new function in the Functions section where you're setting its name, type, and variables

Once called, the program will automatically jump to the code in the function and will run that before continuing with the rest of the program.

You can see that the code will execute the same way whether it has been called from the function or whether it was directly inserted inside the void loop.

Whatever function returns can be caught in another variable or in a comparison.

For example, you can call a function and depending on what it returns, decide whether to enter the loop or not.

There are numerous ways you can use functions, but the premise is the same every time.

You can experiment a bit more with it or continue with the tutorial.

If you want to put the stock firmware back onto your device, you can click the Restore firmware button in the top right corner on CircuitBlocks.