STORY PLAY STORE

Learn to Code through Gameplay

4

Learn how to use relational operators

Video Example:

Material required: Download material .pdf

program BEGIN block
BEGIN block
Variable block
Variable block
Assignment block
Assignment block
Random function call
Random function call ('die roll')
Two dice: one dotted and another with numbers
Die of choice
Relational operators
Relational operators
Die numbers
Die numbers
Numbers
Numbers
Cheackpeas
Cheackpeas or beans

Play

Use the die Small dotted die and the 'die numbers' Small die numbers with younger children. Children typically begin to understand abstract numbers around 4 or 5 years old.
1

What are relational operators?

Relational operators are symbols that allow you to compare two values.

Operator Example
== Equal to 6 == 6
!= Not equal to 4 != 3
> Greater than 5 > 2
< Less than 1 < 2
>= Greater than or equal to 1 >= 1
2 >= 1
<= Less than or equal to 1 <= 1
1 <= 2

Depending on the age and knowledge of the player, they may use more or fewer relational operators.

A child aged 4 years old is capable of using the '==' ("equal to") and '!=' ("not equal to") operators, but may find it more difficult to use the '>' ("greater than") and '<' ("less than") operators, and much more so the '>=' ("greater than or equal to") and '<=' ("less than or equal to") operators. For younger players, it may be more suitable to use "bigger than" and "smaller than" instead of "greater than" and "less than". If the player is young, it's not advisable to work with different operators in the same activity until they are familiar with them. Introduce the operators progressively.

2

How do I play?

Use the random function call ('roll die') Random function call within an assignment block and assign the die value to a variable. Then use relational operators to compare the value:

Start program that assign a random value to a variable 'a'
1

"Calling the random function" (roll die)

Calling random function program to assign a random value to a variable
2

"Assigning the value '3' to variable 'a' "

Assigning the value '3' to the variable 'a'
3

Place the relational operator '==' ("equal to") to the right of the variable. Then, the player should place representations of the number equal to the value of the variable 'a' to the right of the operator:

Comparing value of variable 'a' using relational operators.
3

Depending on the player's knowledge, introduce more or fewer operators:

Using more available relational operators to compare the value of variable 'a'

Examples:

Place the relational operator '==' ("equal to") to the right of the variable. The player must place the numerical representation that is "equal to" the value 4 to the right of the '==' operator.

Place the relational operator '!=' ("not equal to") to the right of the variable. The player must place a numerical representation that is "different from" the value 4 to the right of the '!=' operator.

Place the relational operator '>' ("greater than") to the right of the variable. The player must place a numerical representation that is less than the value 4 to the right of the '>' operator.

etc.