This video example demonstrates how to declare a global variable. Variables in E-Prime are defined and accessible within a particular scope. That is, variables are temporary, and are discarded after the scope (e.g., Procedure) in which they are defined is exited. However, variables declared in the User tab of the Script window are defined globally, so their scope spans the entire program.
Global variables may then be initialized within the structure of the experiment using an InLine object. Most commonly, the initialization of global variables would be entered in an InLine object at the beginning of the experiment structure. Variables declared globally may be accessed at any point in the structure of the experiment (i.e., their scope includes the entire experiment).
In contrast, a Dim statement within a Procedure, subroutine or function declares variables locally to that Procedure, subroutine or function. Variables declared within a particular scope are not automatically "seen" outside of that scope. Variables are declared within a particular scope using the Dim statement. Once that scope is exited, the variable is discarded. For example, a variable declared at the trial level with the Dim command is discarded after the trial Procedure is completed.
Please see the following link for a video on this topic: http://www.pstnet.com/internal/kbimage/3844-1.swf
Please see the following link for the experiment used in the video: http://www.pstnet.com/support/samples.asp?Mode=View&SampleID=32
This topic applies to: