205k views
0 votes
How do I create a boolean variable identifier is raining with the value set to true?

User Inertia
by
7.8k points

1 Answer

0 votes

Answer:

bool is_raining=true;

or

bool is_raining=1;

Step-by-step explanation:

So to create a boolean variable of name is_raining and set it's value to be true.First you have to use the data type bool which tells the compiler that the variable is of type boolean it can only hold true or false.

Write the name of the variable that is in our case is_raining.To set it's value to be true.We have to use assignment operator = and set it true or 1.

Any value other than 0 is considered as true and 0 is considered as false.

User Franziska
by
8.2k points