Page 98 - Digicode_AI_class_6
P. 98
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 homework? Is the time past 6 PM? Should you go to play?
Yes Yes Yes
Yes No No
No Yes No
No No No
OR Operator
OR operator is used to check if either one of two or more conditions is TRUE or Yes.
In OR operator:
If any of the condition is true, the operator returns TRUE or Yes.
If all the conditions are false, the operator returns FALSE or No.
Example 2: You should go to play outside for an hour, if you have completed your homework , or the
time is past 6 PM. Otherwise, you should not go outside to play.
Leadership & Responsibility
Conditions: 1. Have you completed your homework? Initiative
2. Is the time past 6 PM?
Decision: Should you go to play outside for an hour or not?
Answer: Yes, past 6 PM you can go to play outside for an hour, if you have completed your homework,
if you have not completed your homework then complete it.
Pseudocode:
Program Start
IF (You have completed your homework) OR (The time is past 6 PM)
THEN
Go to play outside for an hour
ELSE
96 DigiCode AI-VI

