‫Let's continue with primitive data types.
‫And in this video we'll learn about Booleans.
‫Imagine you have a magical switch with only two settings on and off.
‫In Java, we have a special data type called Boolean, which is just like that magical switch.
‫A boolean can only have two values.
‫True or false?
‫It's like asking a question and answer can be either yes for true or no for false.
‫Let's see how it looks in code to create a boolean variable.
‫In Java we start by boolean keyword and let's say I'll name it as is raining equal to true.
‫You can see either true or false.
‫I'll make it as true.
‫In this example we created a boolean named is raining and set it to true.
‫This means that it's currently raining.
‫If we change it to false, it means it's not raining.
‫You can use booleans in many situations.
‫For example, in the game you can use Boolean to check if the player has collected all the coins.
‫So for example boolean and all coins collected.
‫This is the name of the variable and the value is false.
‫If the user or the player collects all the coins, you can change it to.
‫True.
‫So all coins equal to true.
‫You can see that I changed this variable from false to true when the user and when the player collects
‫all the coins.
‫Booleans are so helpful.
‫For making decisions in your program.
‫Later on when we talk about conditional statements and and we will see booleans in more detail.
‫So in summary, the Boolean data type is in Java is like a magical switch that can only have two settings
‫on for true false for off.
‫You can use it to answer questions to make decisions in your program.
‫It's a simple but powerful tool to control what your program does based on different situations.