Page 61 - Dig_CodeAI_V2.1_Class_7
P. 61
Look at these examples:
Example 1: Example 2:
READ Subject READ marks
IF Subject = "Maths" THEN IF marks > 50 THEN
PRINT "Take out Maths book & PRINT "Pass"
notebook" ELSE
ELSE PRINT "Fail"
PRINT "Check timetable"
Example 3: Example 4:
READ Rain READ age
IF Rain = True THEN IF age >= 18 THEN
PRINT "Carry an umbrella" PRINT “You are eligible to vote.”
ELSE ELSE
PRINT "Do not carry an umbrella" PRINT “You are not eligible to vote.”
Critical Thinking
code Quest
A. IF an event occurs, THEN what happens? Complete the sentences.
1. IF the fire alarm rings THEN .
2. IF the referee blows the whistle THEN .
3. IF the traffic light is red THEN .
4. IF I am sick THEN .
5. IF a cell phone battery charge is 0 THEN .
ELSE .
6. IF the Caps Lock key is ON THEN .
ELSE .
B. Write an example of a condition from real life.
Start
IF
True False
Stop
Algorithmic Intelligence 59

