Another data type used in computer programs is the logical. This data type is used in commands associated with computer logic; in other words, when our computer evaluates something to be true or false.

 

Therefore, the logical data type has only two possible values : 1 (true) and 0 (false). These values are used to represent the result of boolean expressions, comparing different variables, numbers, and strings in a program.

 

Logical operations perform a comparison to determine if two things are equal (==), less than (<), greater than (>), less than or equal to (<=), greater than or equal to (>=), and not equal (~=).

 

 

Logicals and boolean expressions are an important part of conditional statements.

Receive Updates

No spam guarantee.