EXIT
Description
In a DO…LOOP or a FOR…NEXT control
structure, passes control out of the current loop. EXIT takes
no parameters.
Syntax
|
1 |
EXIT |
Usage
An EXIT statement in a DO…LOOP or FOR…NEXT control
structure causes control to pass to the statement following the LOOP or NEXT statement.
In a nested loop, an EXIT statement passes control
out of the current loop structure.
For information on how to jump to the end of
the loop and continue looping, see CONTINUE .
Examples
[Example 1]
This EXIT statement causes the loop to
terminate if an element in the Nbr array equals
0:
|
1 |
int Nbr[10] |
|
1 |
int Count = 1 |
|
1 |
// Assume values get assigned to Nbr array... |
|
1 |
DO WHILE Count < 11 |
|
1 |
IF Nbr[Count] = 0 THEN EXIT |
|
1 |
Count = Count + 1 |
|
1 |
LOOP |
|
1 |
MessageBox("Hi", "Count is now " + String(Count) ) |
[Example 2]
This EXIT statement causes the loop to
terminate if an element in the Nbr array equals
0:
|
1 |
int Nbr[10] |
|
1 |
int Count |
|
1 |
// Assume values get assigned to Nbr array... |
|
1 |
FOR Count = 1 to 10 |
|
1 |
IF Nbr[Count] = 0 THEN EXIT |
|
1 |
NEXT |
|
1 |
MessageBox("Hi", "Count is now " + String(Count) ) |
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest