## Formulas

If you are not at all familiar with formulas, we suggest you take a look at getting started with formulas first. In this section, we’ll cover formulas more in depth. It will therefore be useful to do the guided tour before you start.

Formulas are the actions in the Berkeley Studio that the user does not directly see or interact with. They can be shown on screen, for example through texts or questions, but by default they aren’t. Aside from the most basic models, almost all models make use of formulas.

All formulas change variables. A variable can be anything. For example, in the Studio you can create a question called `name` that asks for the name of the user. The user can then enter ‘John’ and proceed. The variable `name` just got the value ‘John’! Formulas work the same way: you can create a formula called `greetings` that greets a user:

What this formula does is create a new variable called `greetings`. It assigns the value `'Greetings to you, ' + start.name + '!'` to this variable. In this value, there are two pieces of text and another variable. Pieces of text always have to be entered within single quotes (’). So our variable `greetings` contains two texts: 'Greetings to you, ’ and ‘!’. In between the texts we put the variable `name` from the start node. Last but not least, the three elements are added together with the plus signs.

You can also do more advanced things. For example, suppose we also want to greet the user based on his or her gender. To do so, we first ask the gender of the user, then convert that into the right salutation and add that to the greeting. If you do not understand the `(gender = 'Male')` section to the right of the salutation-formula, please take a look at getting started with conditions.

It is important to understand what you can do with formulas. You can create and change numbers, texts, conditions and much more with them. For example, you can manipulate dates, assign scores to questions or add texts to user answers.

One important feature of formulas are functions. Functions are explained in detail in the next sections.