Hi everyone,

I want to end a routine (involving text input to solve math problems) after a specified time. I used this code

```
if globalClock.getTime() - startTime >= 10:
trials_math.finished = True
continueRoutine = False
```

To avoid using two ‘continueRoutine = False’, I used this code for a ‘return’ response.

```
n= len(theseKeys)
i = 0
while i < n:
if theseKeys[i] == 'return' and len(inputText) > 0:
inputText = ''
thisExp.nextEntry()
```

The routine quits successfully after the time limit, however the loop does not work. When I press ‘enter’, the text I have just inputted disappears but the math problem is keeping the same. Here’s a screenshot of the setting of the text component

Does anyone know how to deal with this? Thanks a lot!

Xiaotong