Functions

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.

random image

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.

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.