Assume you have a presentation and you want it to stay on the screen for 10 seconds, you may write code something like
pause(10)
or WaitSecs(10)
It’s fine except you can do nothing within those 10s. What if you want to do something else during the 10s (e.g check if subject pressed a button, or check if the scanner emits some signal)? In this case you should not use pause
or WaitSecs
, but instead use a while loop:
startTime = GetSecs; while(GetSecs - startTime < 10) ... check keyboard input etc end