Computers can compare things — Computing, 4–6
A computer can check whether one thing matches, comes before, or is bigger than another. This simple skill helps it choose what to show or do next.
Checking two things
Comparing means putting two pieces of information side by side and checking a rule. Are the two colours the same? Is five more than three? A computer does not need to understand the things as a person does; it checks the features and gives a result that the program can use.
Why compare?
A computer often has to choose between actions, but it cannot choose by guesswork. It compares what it sees with a rule, then takes the matching path. A music app can ask whether a song has finished; a game can ask whether your score is higher than a target. Comparison turns information into a useful next step.
The three-star game
A game says: show a medal when the score is 3 or more. Your score is 2, so the computer compares 2 with 3 and finds that 2 is not enough; no medal appears. You win another point, making 3. The computer compares again, finds that 3 is enough, and shows the medal. You can see that the rule stays the same while the number changes.
A bigger-looking number
When numbers have different lengths, it is tempting to look only at the first digit. You might think 9 is less than 12 because 9 comes before 1 when you read the two numbers. But 9 is still less than 12 because you can count nine objects and then twelve. A computer needs the correct comparison rule too; it does not repair a poorly chosen rule by itself.
Comparisons all around you
A camera app compares a face with the place where it should focus. A game compares your score with a goal, and a shopping app compares prices. These are not human opinions hiding inside the device. They are checks made with chosen information and rules, so you should ask what exactly is being compared.
Keep exploring
Other languages
Loading MyLeoNes™…