## Learn creative coding writing simple programs

### 94. Boolean: true or false?

The boolean data type is often used for making decisions. A boolean variable can only have two different values: true and false. There are different ways of comparing values. We can test if a number is greater or smaller than another number, if they are equal, if they are different. In each case a value of true or false is returned. We can print this value, or store it in a variable of type boolean.

The same way numbers can be added, substracted and multiplied, boolean values (true and false) can be combined by using AND, OR and NOT. Imagine we have two boolean values called A and B. Each can be either true or false. A AND B is true only if both variables are true. A OR B is true if any of the two variables is true. When writing programs you don't write AND, OR or NOT. You use &&, || and ! instead. For example if(x > 10 && x < 20) { print("x is a number between 10 and 20"); }

If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)