Header Ads

Conditions/Selection/Boolen Expresstion

Condition
Many a times, we want a specific set of instructions to be executed in one situation, and an entirely different set of instructions to be executed in another situation. That particular situation can be said to be a condition.
Generally, these conditions are represented using expressions or more specifically Boolean Expressions. A boolean expression can be either true or false.
Most conditions that we use to perform comparison will have one of these forms:


variable     relational-operator    variable
variable     relational-operator    constant
variable     equality-operator      variable
variable     equality -operator     constant



Assume
                       int x = 5 ;
                 int y = 12 ;
                 char ch = ‘A’;
                 float f =2.5;

see the examples below:



No comments