Creating a loop with conditional exit
Hi everyone,
I am trying to create a loop with a conditional exit. The condition is having no error on a multiple-choice test. If they have an error, they have to take the test again until they give correct answers to all questions.
I have the codes for this. When I try to initialise the variables, I say trialIDx = 0 totalACC = 0 to start with the value of 0 at the beginning. The codes will be calculating the correct answers and divide them by the number of the questions. The code to exit the loop is below:
If totalACC/trialIDx < 1.0 Then
TextDisplay3.Text = "You need to work on the causal relationship again. When you feel ready, try to take the Multiple-Choice Test again."
trialIDx = 0
totalACC = 0
FeedbackDisplay1.ACCStats.Reset
GoTo RedoPractice
End If
If totalACC/trialIDx = 1.0 Then
trialIDx = 0
totalACC = 0
FeedbackDisplay1.ACCStats.Reset
GoTo DoTask
End If
When I try to run the experiment it gives me an error for the initialising variables part. I am wondering why.
I would appreciate it if you can help.
Many thanks,
Elif
Please sign in to leave a comment.
Comments
0 comments