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 (See below for screenshot). I am wondering why.
P.S.: I am not very familiar with coding process.
I would appreciate it if you can help.
Many thanks,
Elif
The error message "Variable not defined" means that, well, you tried to use a variable that has not yet been defined. E-Prime requires that all variables be defined before use, e.g.,
Dim trialIDx as Integer
See the "Dim" topic in the E-Basic Help for more details.
Also, I have a feeling that you want to define these as global variables. For information on that, please see the "Using E-Basic" chapter in the E-Basic User's Guide.
-- David McFarlane
________________________________________
From: e-p...@googlegroups.com <e-p...@googlegroups.com> on behalf of Elif Bastan <basta...@gmail.com>
Sent: Monday, November 15, 2021 6:38 AM
To: E-Prime
Subject: Creating a loop with conditional exit (gives error)