I want to keep track of how many times the respondent has answered "yes" to a yes/no question. So, I created a loop that increments the score every time the respondent presses "yes".
However, the score data resets to zero when the respondent returns to the original point.
Code:
S1: What is the shape of this picture?
- A: a square
- B: a circle
- C: a triangle
The correct answer would be C, leading to S4.
If the respondent chooses A or B, it leads to S2.
In S2, the respondent can choose whether they want help or to try again.
- yes: I want help
- no: back to S1
Code in S2:
If: incorrect, need a hint? is Yes Add 1 to @score If: incorrect, need a hint is Yes go to S3
If: incorrect, need a hint is No go to S1
Now, coming back from the loop where we added +1 to the score to the original S1, @score is nullified. Why?