Group: Administrators
Posts: 13K,
Visits: 104K
|
Yes, using two distinct variables for two distinct things is the proper way to do it, in my opinion. Nevertheless, my initial point still stands:
(1) A computer, and by extension any programming language, requires *unambiguous* instructions. Defining multiple global variables with the same name does not meet that condition for the reasons already explained: How is the machine supposed to know which variable you mean in any given situation? It can't.
(2) Removing the duplicate definitions would not have made a difference. To see why, think about *when* values.wordlist gets used for what. It is of course possible to use the variable for different things at different times. It is still the same, single variable, though. Example:
<values> / myvalue = 0 </values>
<block myblock> / trials = [1-4=sequence(digit, letter)] </block>
<trial digit> / ontrialbegin = [values.myvalue=list.digitlist.nextvalue] / stimulusframes = [1=mytext] / trialduration = 1000 </trial>
<trial letter> / ontrialbegin = [if (values.myvalue==1) values.myvalue=list.alist.nextvalue] / ontrialbegin = [if (values.myvalue==2) values.myvalue=list.blist.nextvalue] / stimulusframes = [1=mytext] / trialduration = 1000 </trial>
<list digitlist> / items = (1,2,1,2) </list>
<list alist> / items = ("A1", "A2") </list>
<list blist> / items = ("B1", "B2") </list>
<text mytext> / items = ("<%values.myvalue%>") </text>
<data> / columns = [subject trialnum trialcode values.myvalue] /separatefiles = true </data>
|