Press Ctrl + C to stop the running program
Use a break statement to exit a loop
Use a return statement to exit the function containing the loop
Use a condition in the loop that becomes false
Close the terminal and run the program again if needed
Press Ctrl + C to stop the running program
Use a break statement to exit a loop
Use a return statement to exit the function containing the loop
Use a condition in the loop that becomes false
Close the terminal and run the program again if needed