Comprison operators are used with conditional statements to compare data.
In a way this is how computers think and make decisions.
It is really quite simple but because computers make so many decisions so quickly they can do amazing things.
Comparators can compare text, e.g in a spelling test app the answer input by a user is compared with the correct answer by the block....
if answer = cat then
see the script below.
Comprison operators are used with conditional statements to compare data.
In a way this is how computers think and make decisions.
It is really quite simple but because computers make so many decisions so quickly they can do amazing things.
Comparators can compare text, e.g in a spelling test app the answer input by a user is compared with the correct answer by the block....
if answer = cat then
see the script below.
Comparators can compare integers (computing term for numbers) such as if a player's score has reached a game's target number.....
If score = 10
Watch the video below to learn how comparitors are programmed.
Read through the age checker script below to understand how it works.
Q29. Which comparitor is used in the script above, equals, greater than or less than?
Q30. Would a child be allowed to play the game if they were 9 years old?
The script on the right is for a greenhouse control system.
The temperature has to be kept at the best temperature for the plants to grow.
This temperature is known as the default setting.
Study the control system script above.
Q31. What is the default setting in degrees C?
Q32. What will happen if the temperature is 19 degrees C?
Q33. What will happen if the temperature is above the default setting?