Wednesday, June 19, 2019 01:13

Boolean variable type

The Boolean variable type is probably the easiest type of variable. It doesn’t have a “maximum range”, it can’t produce “overflowexceptions, it’s not affected by precision, etc. In fact, Boolean variable type can only have two values: true  or falseThey are almost exclusively used for calculations of logical expressions. They are declared using the keyword bool.

Here is a short example where we can use Boolean variables:

When compiled and ran, the program will display the following output:
boolean variable type

1. Declare a variable isFemale of type bool and assign a value to it depending on your gender.




Tags: , ,

Leave a Reply