How can the robot get the next statement

How can the robot get the next statement of the program after receiving a signal, and continue to execute the statement after the signal is turned off,Please help me. Thank you