Program what happens when the NextButton is clicked. Get the event handler block for this event.
When the NextButton is clicked, the following things should happen:
To do this, create this code:
The code uses the Index Variable to keep track of the question number.
Try the code on your phone now! Click the Next button to change the picture and the question. What happens if you keep pressing next?
You got an error! This is because you got to the end of the list and the program didn’t know what to do.
To fix this error, use an If Statement block. You need a statement that says “If you get to the end of the quiz, then go back to the start”. Try this:
Test the code again! The quiz will now go back to the start!