![Free-eBooks.net](/resources/img/logo-nfe.png)
![All New Design](/resources/img/allnew.png)
18.03 HOW TO USE SIMPLE LOOP
loop
exit when <<variable>> = 100;
end loop;
For Example:
declare
some-val number;
cumulative-value number;
begin
some-val : = 35 ; -- initital value assigned loop
exit when cumulative-value > 2000 -- sets the value to discontinue looping
cumulative-value := cumulative-value + some-Val;
some-Val := some-Val + 1;
end loop;
end;
Here it will go on add as 35 + 36 + 37 + 38 ….. and when the cumulative value exceeds 2000 this program quits and stop incrementing the some-val variable,