Page 48 - CloudGPT_C7_Flipbook
P. 48
Logical Operator
AND OR NOT
AND operator
AND operator is used to check if two or more conditions are TRUE or Yes.
In AND operator:
If all the conditions are true, the operator returns TRUE or Yes.
If any one of the conditions fails, the operator returns FALSE or No.
Life Skills & Values
Example 1: You should go to play after 6 PM for an hour only after
you have completed your homework.
Condition:
1. Have you completed your homework?
2. Is the time past 6 PM?
Decision: Should you go to play or not?
Answer: Yes, past 6 PM for an hour, if you have completed your homework, if you have not
completed your homework then complete it.
Pseudocode:
Program Start
IF (Homework completed) AND (Time is past 6 PM)
THEN
Go to play outside for an hour
ELSE
Complete your homework
Program End
Possible combinations of the example 1:
Condition 1 Condition 2 Decision
(Have you completed your (Is the time past 6 (Should you go to
homework?) PM?) play?)
Yes Yes Yes
Yes No No
No Yes No
No No No
46 Premium Edition-VII

