How can I get consecutive responses with one key?

hello! I have a question because I don’t know how to write the code for the key response.
In the experiment loop, make it win or lose when the space key is pressed when the shape is within a certain area. Press the space key again to move on to the next trial. At this time, I don’t know how I can get a response with one key twice in a row.

Based on your last two questions, it seems like a good idea if you find someone close to you that you can ask these questions to, as you’ll likely have many more, or take a beginner programming course. These are not specific to Psychtoolbox or matlab

Thank you for answer.
I am currently in a situation where I have to write the above code as an assignment for a programming class. I asked the teacher for help, but I got a reply telling me to take a good look at the simple experimental code on the demo site and think about it…

Then you’ll get the same reply from me. Computers do exactly what you tell them to, nothing more and nothing less. So you probably have to ask it more than once about key presses if you want to have more than one response

Thank you for your reply. Let’s rewrite the code and see how the computer responds.