Page 134 - TP_Prime_V2.2_Class8
P. 134
For example, look at these programs:
username = "Orange"
password = "secure123"
IF username = "Orange" AND password = "secure123"
THEN
Prime (Ver. 2.2)-VIII ELSE
PRINT "Access granted"
PRINT "Access denied"
Access granted
user_type = "member"
coupon_value = "invalid"
132 IF user_type = "member" OR coupon_value = "valid"
THEN
PRINT "Eligible for discount"
ELSE
PRINT "Not eligible for discount"
Eligible for discount
What did you Notice?
Both the programs have two IF conditions joined together using AND or OR. The final
result depends on the combined result.
• AND: results in true only if both the conditions are true. If any one condition is false, the
result will be false.
• OR: results in true if any one of the conditions is true. If both are false, the result will
be false.
Now, write your answers for both.
1. age =20 2. shop = 500
IF age >= 12 AND age <= 19 THEN customer = "new"
IF shop > 100 OR customer = "old"
PRINT "You are a teenager" THEN
PRINT "Eligible for a free gift"
ELSE
ELSE
PRINT "You are not a teenager" PRINT "Not eligible for a free gift

