How to stop for loop when receive serial strings from serial port.

MorganS:
You want to execute commands in the order that they arrive except for the special "stop" command that jumps the queue?

I'm thinking that perhaps a button would be better than a command.

Is this G-code? I see some G's. There are a number of good G-code programs available for the Arduino. Start with one of them. They might seem complex to start with but you're creating your own spaghetti code that will be more complex by the time you finish.

I have tried other G-code interpreter program available for the Arduino like UniversalGcodeSender, I'm trying to write my own G-code Interpreter GUI on C# because it's my school project, then send strings to Arduino and I can run g-code program from those read string already, but I can not read string from the serial port while the motor is running g-code program(for loop).