arrow_back Keep Trying!
This video will show you how to give your friend a second chance to guess your lie correctly.
To do this, make the sprite repeat the statements until your friend answers correctly..
From the “control” menu, place a “repeat until” loop around the entire code stack, under the “when flag clicked” block.
Test this by clicking the green flag.
Choose a wrong answer first.
The sprite tells you it’s wrong, then goes back to the beginning.
Then, type the correct answer.
The sprite says you’re right, but then it repeats the choices again.
To fix this, program the sprite to stop repeating when a correct answer is entered.
If you look at the “repeat” loop, you’ll see a diamond-shaped space for a boolean statement.
This boolean will check whether something is true or false, just like the one in the “if/else” block.
In this diamond shape you’ll put the boolean that, if true, will stop the sprite from repeating its code.
For this add-on, the program should stop repeating once your friend gets the right answer.
In this example, your friend gets the right answer when the answer they type equals 2.
From the “operators” menu, place an “equals” operator in the “repeat until” block.
From the “sensing” menu, place the “answer” block on one side of the “equals”” block.
On the other side of the “equals” operator, type the number that is the correct answer.
For this example, that’s 2.
Test the code by clicking the green flag.
First, choose an incorrect answer.
The sprite will explain the answer is incorrect, then return to the top of the loop, say the two truths and a lie, and ask which was the lie again.
Try getting it wrong again.
The sprite repeats everything again.
This time, choose correctly.
The sprite says you’re right, then doesn’t return to the beginning of the loop.
Now it’s your turn: Give your friend as many chances as he or she needs to guess the lie using the “repeat until,” “equals,” and “answer” blocks.