| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (17 out of 25)

exit if

This statement causes G2 to exit from a loop before it would normally terminate. The syntax is:

where:


A logical expression that evaluates to true or false.

If the logical expression is true, G2 executes the exit if statement and transfers control to the statement immediately following the loop. If false, G2 does not execute the exit if statement and continues processing the loop.

When G2 encounters an exit if statement within a nested loop, its effect is to transfer control back to the loop immediately enclosing it. For example:

In the above example, when G2 executes the exit if statement (when var-2 has the value 3), it will continue processing with statement-1, rather than statement-2.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (17 out of 25)

Copyright © 1997 Gensym Corporation, Inc.