Magos provided a very good explanation of the bool, but I thought I would show you an example in C++ of how a bool can be used.
You said you were making a game. Well, most games have collision detection, or in other words, a way to tell when one object in the game hits another object in the game.
I will show you a very simple example of this:
you are then able to use this variable CollisionOccurance in other parts of the code. For example, maybe you want the two objects to explode if they hit each other:
if ( Location ( ObjectA ) == Location ( ObjectB ) )
CollisionOccurrance = true;
else CollisionOccurance = false;
Of course, you could also write that same line of code like this:
if ( CollisionOccurance == true ) ExplodeObjects ( ObjectA, ObjectB );
but since you are just learning how to use bools, use the first way which I showed you, unless you consider yourself smart enough to realize how the second way is done and how it works.
if ( CollisionOccurrance ) ExplodeObjects ( ObjectA, ObjectB );
You might also want to do something if they did not collide. Maybe if they dont collide, you want to move each object to a different position on the screen. This can also be done at least two different ways:
or this way:
if ( CollisionOccurrance == false ) MoveObjects ( ObjectA, ObjectB );
Anyways, thats about all. I hope those code examples help out.
if ( !CollisionOccurrance ) MoveObjects ( ObjectA, ObjectB );