Tutorial 7: Build a three-question quiz
You will make: a quiz that stores questions and answers in lists, asks the player each question, and counts correct answers.
Step 1 — Create the data
- In Variables, create a variable named
Scoreand another namedIndex. - Create two lists named
QuestionsandAnswers. - Add three short questions to Questions and the matching answers in the same order in Answers. For example, a question at item 1 must have its answer at item 1.
Step 2 — Ask and check each answer
Build this script using the list reporter blocks and an if block. Select the exact dropdown/list names you created.
when flag clicked
set [Score] to (0)
set [Index] to (1)
repeat (length of [Questions])
ask (item (Index) of [Questions]) and wait
if <(answer) = (item (Index) of [Answers])> then
change [Score] by (1)
change [Index] by (1)
say (join [Score: ] (Score))
Step 3 — Test it
- Start the project and answer all three questions.
- Correct answers should add one point; a wrong answer should leave the score unchanged.
- Run again. Score and Index should reset at the start.
- Try a capital letter change in an answer to see how the current equality block treats text. Avoid making a secret or personal question list.
Gotchas: a list is ordered, and questions/answers must stay aligned. The last item position can be used in supported list blocks, but keep this first project on numbered indices so the logic is easy to inspect. join does not add a space unless the text input includes one.