Page 65 - Touchcode_C6_Flipbook
P. 65
At a Glance
Logical operators are the fundamental blocks which adds a decision-making capability to
code.
AND operator is used to check if two or more conditions are true.
OR operator is used to check if either one of two or more conditions is TRUE.
NOT operator is used to reverse or negate a condition.
To create a complex expression, you may need to combine different logical operators.
Relational operator checks the value of the two operands.
You may come across complex scenarios in using a single if-else loop might not be enough,
in that case you need to use nested conditional statement.
If there is another if-else construct within the if block or the else block, this is called nesting.
Exercise
A. Tick ( ) the correct option.
1. Read the given statements and mark True or false according to the pseudocode given below:
Program Start
IF (Time is between 6 PM and 8 PM)
IF (Day is Saturday or Sunday)
Display Play time
ELSE
Display Study time
Program End
I. Today is Monday and the time is 11.30 AM. Is it a study time?
a. True b. False
II. Today is Saturday and the time is 1.30 AM. Is it a play time?
a. True b. False
III. Today is Wednesday and the time is 5.30 AM. Is it a study time?
a. True b. False
IV. Today is Sunday and the time being 09.30 PM. Is it a play time?
a. True b. False
Control with Conditionals 63

