How to terminate a procedure in the middle of the procedure?

40 views
Skip to first unread message

Brian Kim

unread,
Apr 3, 2024, 10:46:47 PMApr 3
to E-Prime
Hi all,

I am still new to E-prime so I am still learning the basics.

I am conducting an experiment where if a certain number of trials are completed, participants can skip a section of the procedure timeline and move on to the next procedure. I am messing around with inline object to complete this. So far, I have an attribute "trialNum" to record integers and initialized as 0 at the beginning of the experiment. 

Then I have "trialNum = trialNum + 1" after each trial to add 1 to the attribute. Then I have the If statement:

If trialNum = 3, Then
       BlockList.Terminate
End If

But it doesn't seem to want to terminate the procedure until after the procedure has been completed (I tried it with 2 instead of 3 and it terminated the procedure after the procedure was completed) 

All this to ask, how do you terminate a procedure in the middle of a procedure? 

Thanks,
Brian

McFarlane, David

unread,
Apr 4, 2024, 4:39:50 PMApr 4
to e-p...@googlegroups.com

Brian,

E-Prime is acting exactly as designed.  List.Terminate simply instructs E-Prime to not to run another round of the running List, but of course it completes running everything in the current round.

If you want to immediately exit the running Procedure then you have to do a little bit more.  I would add a Label object at the end of the Procedure -- for your example, lets call it BlockProcedureEndLabel.  Then the InLine code would go something like

If trialNum = 3, Then
    BlockList.Terminate
    GoTo BlockProcedureEndLabel
End If

-- David McFarlane

McFarlane, David

unread,
Apr 4, 2024, 4:46:54 PMApr 4
to e-p...@googlegroups.com

Sorry, I did not notice the syntax error in that example code until I posted it.  Here it is again, without the offending comma after the If condition (and adding some parentheses for added clarity):

If (trialNum = 3) Then
    BlockList.Terminate
    GoTo BlockProcedureEndLabel
End If

-- David McFarlane

Reply all
Reply to author
Forward
0 new messages