IF Construct is the most powerful construct in programming language. This construct is used to make decision. This construct check the result on the basis of TRUE and FALSE.
Lets take an example of IF in the form of algorithm. Lets imagine that there are traffic lights.
What are the decision we make after seeing the traffic lights
IF TrafficLight ="RED"
STOP
____________________________________________
IF TrafficLight = "GREEN"
GO (TRUE Block)
ELSE
STOP (FALSE Block)
So here in this example
if the light color is RED and we have seen the RED color it means the condition is TRUE
so our brain tell us that we should stop.
if the light color is GREEN and we have seen the RED color it means the condition is FALSE
so our brain tell us that we should stop.
No comments:
Post a Comment