There are a number of things that could be happening. For a start, you have created
msg at the start of the experiment and given it a value of
'' (note that this immediately overrides the previous value of
'great', so there is no point in having both of those statements there). If the value of
msg doesn’t get updated, then nothing will be seen on screen. There are several possible reasons why the text won’t get updated:
- you might have set the text field to be ‘constant’. That way, it gets the initial blank value of
msg and never changes. Ensure you set it to update every repeat so it gets a new value on every trial.
y<=x/6.7 never evaluates to
True. You can check this by printing the output of the expression to make sure the calculation is giving values you expect.
Secondly, the order of components is important. The code component must be above the text component so that a new value is calculated for
msg before it gets used by the text component. Otherwise, the displayed value of
msg will always lag behind by one trial.
No, a syntax error gets reported to you in an error message, and will stop the experiment running. A syntax error is Python telling you “I don’t even understand this code”. These errors are almost always easy to fix. Unfortunately, most programming bugs are when Python understands our code perfectly, but it’s just that the code doesn’t do what we intended it to do.