If your program is running a loop and you want it to exit the loop without finishing it, you can use the break command. For example, you can define a program
testbreak(a,b) := { local r; while (true) { if (b == 0) {break;} r := irem(a,b); a := b; b := r; } return a; }
If you then enter
it will return
since the while loop is interrupted when b is 0 and a is 4.