User`s guide

E-Prime User’s Guide
Chapter 4: Using E-Basic
Page 142
4.4.7 Test
After the experiment is functioning without errors, it is important to completely test it prior to
running subjects. The Debug object is especially useful for testing an experiment. Use the
Debug.Print command to send variable values to the Output window, and keep track of the
progress of the experiment with a pencil and paper as well. After running the experiment,
examine the output on the Debug tab to view the values. Or, the contents of the Debug tab may
be copied to the clipboard and pasted into another application for more thorough viewing or
analysis. A written-record and the Debug output should be compared to the data file to verify that
all of the variables are being logged, the values are in the correct range, and the sampling is
occurring as expected. It is important to test the script completely, including tests of unlikely
responses and invalid ranges. For more discussion concerning debugging and testing, refer to
Stage 7: Testing the Experiment in Chapter 2-Using E-Studio.
4.5 Programming: Basic
4.5.1 Logical Operators
Logical operators allow comparison and conditional execution (e.g., If trial > 5 Then…). Often,
in script, expressions are used, which compare items using simple mathematical expressions.
> Greater than
< Less than
= Equal to
>= Greater than or equal to
<= Less than or equal to
<> Not equal to
Logical operators are also commonly used in compound expressions. Essentially, logical
operators evaluate two expressions and use a set of rules to determine if the total expression is
true or false.
Operator Returns True Example Result
5 > 2 And 6 + 3 = 9 True And If both expressions are true.
3 * 3 = 9 And 7 < 6 False
5 > 7 Or 8 * 2 = 16 True Or If either expression is true.
8 < 4 and 3 > 2 False
3 + 2 = 5 Xor 5 + 5 >10 True Xor If only one expression is
true. Note that it is False if
expressions are either both
true or both false.
3 + 2 = 5 Xor 5 + 5 = 10 False
4.5.2 Flow Control
Controlling the flow of the script is a critical component of programming. There are two major
types of controlling the flow: conditional statements and loops.
4.5.2.1 Conditional Statements
Conditional statements determine or specify which part of the script should be executed based
on a condition. Contingent branching is often utilized in behavioral research and is based on
whether a specific item is true or false. Specifically, If…Then statements are very commonly
used to control the flow of the code.