3.2 Break Loops

When an error has occurred or when you interrupt GAP, usually by hitting ctr-C, GAP enters a break loop, that is in most respects like the main read eval print loop (see Main Loop). That is, you can enter statements, GAP reads them, evaluates them, and prints the result if any. However those evaluations happen within the context in which the error occurred. So you can look at the arguments and local variables of the functions that were active when the error happened and even change them. The prompt is changed from gap to brk to indicate that you are in a break loop.

There are two ways to leave a break loop.

The first is to quit the break loop and continue in the main loop. To do this you enter quit; or hit the eof (end of file) character, which is usually ctr-D. In this case control returns to the main loop, and you can enter new statements.

The other way is to return from a break loop. To do this you enter return; or return expr;. If the break loop was entered because you interrupted GAP, then you can continue by entering return;. If the break loop was entered due to an error, you usually have to return a value to continue the computation. For example, if the break loop was entered because a variable had no assigned value, you must return the value that this variable should have to continue the computation.

Previous Up Top Next
Index

GAP 3.4.4
April 1997