# How to add Categories and If statements to return different results

Categories are used to provide the user with a finite number of options to select from. They are particularly useful when creating an If statement as they can be used to directly decided if the statement is true or false. In this guide we will go over how you can set up a basic If statement with categories

To start off, we are going to need to define our category, do this by adding a new category card + > Add a category > New category

empty category

We then need to define the category name and the options. You can add a new option by hitting enter after you have finished typing your current one.

colour category

Once we have defined our category we need to allow the user to select a value from it. To do this, we need to add a category input card + > Add an input > Category. Give your input a symbol that you will use to reference it, select your category from the category dropdown and select a value you want to use for demonstration purposes in the report value box.

category input

You now need to add a variable for all of your category options, this will allow us to reference them in the If block + > Add a variable > Category

category variable

Repeat this for all your options. You are now able to reference each of your options within your if block. To do this, lets add an If card + > Add a logic statement > If. For the left hand side symbol you should select your category input, for the operator select = and for the right symbol select one of your category variables. Try selecting the one that matches your report value first.

Now that we have our If card set up, lets make it do something when it is true. Inside of our if block, add any text card + > Add text and images to report > .... Write some text you want to appear when the condition we specified is met

category if

And if we look at the report

if report

It worked! Our text has been displayed. Try changing the report value for your category input to see what happens.

We can add additional logic to in the case of one of the the other options being selected.

else if

Try adding Else If and Else cards to your calculation and see what you can do.

If blocks don't just have to display text, you can encase any logic you want in them. Try them out on your calculation now.