IF ... AND ... THEN ...
David McFarlane
mcfarla9 at msu.edu
Mon Nov 11 21:14:28 UTC 2013
Naomi,
What if you try something more like
If (CentralS.RESP = "5" and Distractor.RESP = "") Then
WritePort &H378, 5
sleep 2
WritePort &H378, 0
End If
Comments:
- In E-Basic, the "&" operator means string concatenation, not
logical And (see the "& (operator)" topic in the E-Basic Help
facility). For logical/binary And, you want, well, "And" (and note
that E-Basic ignores case).
- The If-Then part must exist on one logical line, without any comma.
- If the "Then" part of the statement covers more than one line, then
you must use the full "If-Then... End If" structure -- see the
"If...Then...Else (statement)" topic in the E-Basic Help facility, or
consult any VBA reference.
- If you want to compare RESP to (none), then you must use an empty
string, i.e., "". The sting " " indicates a string containing one
space, which is not the same as an empty string. Furthermore, RESP
would never contain the string " ", because each space in RESP would
be encoded as {SPACE} -- see the "{key} nomenclature" topic in the
E-Basic Help facility.
In general, you may study the Guides that came with E-Prime, VBA
(Microsoft Visual Basic for Applications) documentation, and the
E-Basic Help facility to get most of this basic information.
Regards,
-----
David McFarlane
E-Prime training
online: http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter: @EPrimeMaster (https://twitter.com/EPrimeMaster )
/----
Stock reminder: 1) I do not work for PST. 2) PST's trained staff
take any and all questions at https://support.pstnet.com , and they
strive to respond to all requests in 24-48 hours, so make full use of
it. 3) In addition, PST offers several instructional videos on their
YouTube channel (http://www.youtube.com/user/PSTNET ). 4) If you do
get an answer from PST staff, please extend the courtesy of posting
their reply back here for the sake of others.
\----
At 11/11/2013 03:03 PM Monday, vanlessen.naomi at gmail.com wrote:
>Dear all,
>
>I need to write an inline stating:
>
>If Stimulus1.RESP = 5 AND if Stimulus2.RESP is (none), THEN (write
>trigger to port), but I keep on getting error messages that after
>'If Stimulus1.RESP = 5' it expects ', then', instaed of taking the
>second part (AND if Stimulus2.RESP is (none)) into consideration.
>
>If (CentralS.RESP = "5" & Distractor.RESP = " "),
>then WritePort &H378, 5
>sleep 2
>WritePort &H378, 0
>
>Can anyone tell me what I'm doing wrong here?
>
>Thank you!
>
>Best,
>Naomi
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/528148e8.0b39320a.7516.ffff9c53SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/groups/opt_out.
More information about the Eprime
mailing list